<86>Apr 16 14:47:54 userdel[77234]: delete user 'rooter' <86>Apr 16 14:47:54 userdel[77234]: removed group 'rooter' owned by 'rooter' <86>Apr 16 14:47:54 userdel[77234]: removed shadow group 'rooter' owned by 'rooter' <86>Apr 16 14:47:54 groupadd[77249]: group added to /etc/group: name=rooter, GID=519 <86>Apr 16 14:47:54 groupadd[77249]: group added to /etc/gshadow: name=rooter <86>Apr 16 14:47:54 groupadd[77249]: new group: name=rooter, GID=519 <86>Apr 16 14:47:54 useradd[77262]: new user: name=rooter, UID=519, GID=519, home=/root, shell=/bin/bash <86>Apr 16 14:47:54 userdel[77290]: delete user 'builder' <86>Apr 16 14:47:54 userdel[77290]: removed group 'builder' owned by 'builder' <86>Apr 16 14:47:54 userdel[77290]: removed shadow group 'builder' owned by 'builder' <86>Apr 16 14:47:54 groupadd[77310]: group added to /etc/group: name=builder, GID=520 <86>Apr 16 14:47:54 groupadd[77310]: group added to /etc/gshadow: name=builder <86>Apr 16 14:47:54 groupadd[77310]: new group: name=builder, GID=520 <86>Apr 16 14:47:54 useradd[77322]: new user: name=builder, UID=520, GID=520, home=/usr/src, shell=/bin/bash <13>Apr 16 14:47:57 rpmi: libgdbm-1.8.3-alt10 1454943334 installed <13>Apr 16 14:47:57 rpmi: libexpat-2.2.4-alt1 1503305345 installed <13>Apr 16 14:47:57 rpmi: libp11-kit-0.23.15-alt1 sisyphus+226408.100.2.1 1554288204 installed <13>Apr 16 14:47:57 rpmi: libtasn1-4.16.0-alt1 sisyphus+245480.100.1.1 1580825062 installed <13>Apr 16 14:47:57 rpmi: rpm-macros-alternatives-0.5.1-alt1 sisyphus+226946.100.1.1 1554830426 installed <13>Apr 16 14:47:57 rpmi: alternatives-0.5.1-alt1 sisyphus+226946.100.1.1 1554830426 installed <13>Apr 16 14:47:57 rpmi: ca-certificates-2020.01.23-alt1 sisyphus+244791.300.2.1 1580285500 installed <13>Apr 16 14:47:57 rpmi: ca-trust-0.1.2-alt1 sisyphus+233348.100.1.1 1561653823 installed <13>Apr 16 14:47:57 rpmi: p11-kit-trust-0.23.15-alt1 sisyphus+226408.100.2.1 1554288204 installed <13>Apr 16 14:47:57 rpmi: libcrypto1.1-1.1.1d-alt1.1 sisyphus+237931.100.2.1 1569235729 installed <13>Apr 16 14:47:57 rpmi: libssl1.1-1.1.1d-alt1.1 sisyphus+237931.100.2.1 1569235729 installed <13>Apr 16 14:47:58 rpmi: python3-3.8.2-alt1 sisyphus+244999.100.3.1 1585218480 installed <13>Apr 16 14:47:59 rpmi: python3-base-3.8.2-alt1 sisyphus+244999.100.3.1 1585218480 installed <13>Apr 16 14:47:59 rpmi: libpython3-3.8.2-alt1 sisyphus+244999.100.3.1 1585218480 installed <13>Apr 16 14:47:59 rpmi: tests-for-installed-python3-pkgs-0.1.13.1-alt2 1535450458 installed <13>Apr 16 14:47:59 rpmi: rpm-build-python3-0.1.13.1-alt2 1535450458 installed <13>Apr 16 14:48:03 rpmi: libverto-0.3.0-alt1_7 sisyphus+225932.100.1.1 1553994919 installed <13>Apr 16 14:48:03 rpmi: libkeyutils-1.6-alt2 sisyphus+226520.100.2.1 1554512089 installed <13>Apr 16 14:48:03 rpmi: libcom_err-1.44.6-alt1 sisyphus+224154.100.1.1 1552091678 installed <86>Apr 16 14:48:03 groupadd[84971]: group added to /etc/group: name=_keytab, GID=499 <86>Apr 16 14:48:03 groupadd[84971]: group added to /etc/gshadow: name=_keytab <86>Apr 16 14:48:03 groupadd[84971]: new group: name=_keytab, GID=499 <13>Apr 16 14:48:03 rpmi: libkrb5-1.17.1-alt1 sisyphus+242784.100.1.1 1576137330 installed <13>Apr 16 14:48:03 rpmi: libtirpc-1.0.3-alt1 1532008017 installed <13>Apr 16 14:48:03 rpmi: libnsl2-1.1.0-alt1_1 1511548749 installed <13>Apr 16 14:48:03 rpmi: python-modules-encodings-2.7.17-alt4 sisyphus+244873.100.2.1 1581419544 installed <13>Apr 16 14:48:03 rpmi: python-modules-compiler-2.7.17-alt4 sisyphus+244873.100.2.1 1581419544 installed <13>Apr 16 14:48:03 rpmi: python-modules-email-2.7.17-alt4 sisyphus+244873.100.2.1 1581419544 installed <13>Apr 16 14:48:03 rpmi: python-modules-unittest-2.7.17-alt4 sisyphus+244873.100.2.1 1581419544 installed <13>Apr 16 14:48:03 rpmi: python-modules-2.7.17-alt4 sisyphus+244873.100.2.1 1581419544 installed <13>Apr 16 14:48:03 rpmi: python-modules-nis-2.7.17-alt4 sisyphus+244873.100.2.1 1581419544 installed <13>Apr 16 14:48:03 rpmi: python-modules-ctypes-2.7.17-alt4 sisyphus+244873.100.2.1 1581419544 installed <13>Apr 16 14:48:03 rpmi: python-modules-multiprocessing-2.7.17-alt4 sisyphus+244873.100.2.1 1581419544 installed <13>Apr 16 14:48:03 rpmi: python-modules-logging-2.7.17-alt4 sisyphus+244873.100.2.1 1581419544 installed <13>Apr 16 14:48:03 rpmi: python-tools-2to3-2.7.17-alt4 sisyphus+244873.100.2.1 1581419544 installed Building target platforms: i586 Building for target i586 Wrote: /usr/src/in/nosrpm/python3-module-gdata-2.0.18-alt4.nosrc.rpm <13>Apr 16 14:48:07 rpmi: python3-module-pkg_resources-1:41.4.0-alt1 sisyphus+238787.100.2.1 1570608044 installed <13>Apr 16 14:48:07 rpmi: libtinfo-devel-6.1.20180407-alt2 sisyphus+222164.200.1.1 1550686226 installed <13>Apr 16 14:48:07 rpmi: libncurses-devel-6.1.20180407-alt2 sisyphus+222164.200.1.1 1550686226 installed <13>Apr 16 14:48:07 rpmi: python3-dev-3.8.2-alt1 sisyphus+244999.100.3.1 1585218480 installed <13>Apr 16 14:48:07 rpmi: python3-module-setuptools-1:41.4.0-alt1 sisyphus+238787.100.2.1 1570608044 installed Installing python3-module-gdata-2.0.18-alt4.src.rpm Building target platforms: i586 Building for target i586 Executing(%prep): /bin/sh -e /usr/src/tmp/rpm-tmp.80023 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + rm -rf python3-module-gdata-2.0.18 + echo 'Source #0 (python3-module-gdata-2.0.18-alt4.tar):' Source #0 (python3-module-gdata-2.0.18-alt4.tar): + /bin/tar -xf /usr/src/RPM/SOURCES/python3-module-gdata-2.0.18-alt4.tar + cd python3-module-gdata-2.0.18 + /bin/chmod -c -Rf u+rwX,go-w . + echo 'Patch #0 (port-on-python3.patch):' Patch #0 (port-on-python3.patch): + /usr/bin/patch -p1 patching file src/gdata/contacts/client.py + rm -f samples/apps/emailsettings_pop_settings.py + find ./ -type f -name '*.py' -exec 2to3 -w -n '{}' + RefactoringTool: Skipping optional fixer: buffer RefactoringTool: Skipping optional fixer: idioms RefactoringTool: Skipping optional fixer: set_literal RefactoringTool: Skipping optional fixer: ws_comma RefactoringTool: Refactored ./upload-diffs.py --- ./upload-diffs.py (original) +++ ./upload-diffs.py (refactored) @@ -31,8 +31,8 @@ # This code is derived from appcfg.py in the App Engine SDK (open source), # and from ASPN recipe #146306. -import ConfigParser -import cookielib +import configparser +import http.cookiejar import fnmatch import getpass import logging @@ -43,9 +43,9 @@ import socket import subprocess import sys -import urllib -import urllib2 -import urlparse +import urllib.request, urllib.parse, urllib.error +import urllib.request, urllib.error, urllib.parse +import urllib.parse # The md5 module was deprecated in Python 2.5. try: @@ -107,15 +107,15 @@ last_email = last_email_file.readline().strip("\n") last_email_file.close() prompt += " [%s]" % last_email - except IOError, e: + except IOError as e: pass - email = raw_input(prompt + ": ").strip() + email = input(prompt + ": ").strip() if email: try: last_email_file = open(last_email_file_name, "w") last_email_file.write(email) last_email_file.close() - except IOError, e: + except IOError as e: pass else: email = last_email @@ -131,20 +131,20 @@ msg: The string to print. """ if verbosity > 0: - print msg + print(msg) def ErrorExit(msg): """Print an error message to stderr and exit.""" - print >>sys.stderr, msg + print(msg, file=sys.stderr) sys.exit(1) -class ClientLoginError(urllib2.HTTPError): +class ClientLoginError(urllib.error.HTTPError): """Raised to indicate there was an error authenticating with ClientLogin.""" def __init__(self, url, code, msg, headers, args): - urllib2.HTTPError.__init__(self, url, code, msg, headers, None) + urllib.error.HTTPError.__init__(self, url, code, msg, headers, None) self.args = args self.reason = args["Error"] @@ -190,10 +190,10 @@ def _CreateRequest(self, url, data=None): """Creates a new urllib request.""" logging.debug("Creating request for: '%s' with payload:\n%s", url, data) - req = urllib2.Request(url, data=data) + req = urllib.request.Request(url, data=data) if self.host_override: req.add_header("Host", self.host_override) - for key, value in self.extra_headers.iteritems(): + for key, value in self.extra_headers.items(): req.add_header(key, value) return req @@ -217,7 +217,7 @@ account_type = "HOSTED" req = self._CreateRequest( url="https://www.google.com/accounts/ClientLogin", - data=urllib.urlencode({ + data=urllib.parse.urlencode({ "Email": email, "Passwd": password, "service": "ah", @@ -231,7 +231,7 @@ response_dict = dict(x.split("=") for x in response_body.split("\n") if x) return response_dict["Auth"] - except urllib2.HTTPError, e: + except urllib.error.HTTPError as e: if e.code == 403: body = e.read() response_dict = dict(x.split("=", 1) for x in body.split("\n") if x) @@ -253,14 +253,14 @@ continue_location = "http://localhost/" args = {"continue": continue_location, "auth": auth_token} req = self._CreateRequest("http://%s/_ah/login?%s" % - (self.host, urllib.urlencode(args))) + (self.host, urllib.parse.urlencode(args))) try: response = self.opener.open(req) - except urllib2.HTTPError, e: + except urllib.error.HTTPError as e: response = e if (response.code != 302 or response.info()["location"] != continue_location): - raise urllib2.HTTPError(req.get_full_url(), response.code, response.msg, + raise urllib.error.HTTPError(req.get_full_url(), response.code, response.msg, response.headers, response.fp) self.authenticated = True @@ -283,34 +283,34 @@ credentials = self.auth_function() try: auth_token = self._GetAuthToken(credentials[0], credentials[1]) - except ClientLoginError, e: + except ClientLoginError as e: if e.reason == "BadAuthentication": - print >>sys.stderr, "Invalid username or password." + print("Invalid username or password.", file=sys.stderr) continue if e.reason == "CaptchaRequired": - print >>sys.stderr, ( + print(( "Please go to\n" "https://www.google.com/accounts/DisplayUnlockCaptcha\n" - "and verify you are a human. Then try again.") + "and verify you are a human. Then try again."), file=sys.stderr) break if e.reason == "NotVerified": - print >>sys.stderr, "Account not verified." + print("Account not verified.", file=sys.stderr) break if e.reason == "TermsNotAgreed": - print >>sys.stderr, "User has not agreed to TOS." + print("User has not agreed to TOS.", file=sys.stderr) break if e.reason == "AccountDeleted": - print >>sys.stderr, "The user account has been deleted." + print("The user account has been deleted.", file=sys.stderr) break if e.reason == "AccountDisabled": - print >>sys.stderr, "The user account has been disabled." + print("The user account has been disabled.", file=sys.stderr) break if e.reason == "ServiceDisabled": - print >>sys.stderr, ("The user's access to the service has been " - "disabled.") + print(("The user's access to the service has been " + "disabled."), file=sys.stderr) break if e.reason == "ServiceUnavailable": - print >>sys.stderr, "The service is not available; try again later." + print("The service is not available; try again later.", file=sys.stderr) break raise self._GetAuthCookie(auth_token) @@ -347,7 +347,7 @@ args = dict(kwargs) url = "http://%s%s" % (self.host, request_path) if args: - url += "?" + urllib.urlencode(args) + url += "?" + urllib.parse.urlencode(args) req = self._CreateRequest(url=url, data=payload) req.add_header("Content-Type", content_type) try: @@ -355,7 +355,7 @@ response = f.read() f.close() return response - except urllib2.HTTPError, e: + except urllib.error.HTTPError as e: if tries > 3: raise elif e.code == 401 or e.code == 302: @@ -385,35 +385,35 @@ Returns: A urllib2.OpenerDirector object. """ - opener = urllib2.OpenerDirector() - opener.add_handler(urllib2.ProxyHandler()) - opener.add_handler(urllib2.UnknownHandler()) - opener.add_handler(urllib2.HTTPHandler()) - opener.add_handler(urllib2.HTTPDefaultErrorHandler()) - opener.add_handler(urllib2.HTTPSHandler()) + opener = urllib.request.OpenerDirector() + opener.add_handler(urllib.request.ProxyHandler()) + opener.add_handler(urllib.request.UnknownHandler()) + opener.add_handler(urllib.request.HTTPHandler()) + opener.add_handler(urllib.request.HTTPDefaultErrorHandler()) + opener.add_handler(urllib.request.HTTPSHandler()) opener.add_handler(urllib2.HTTPErrorProcessor()) if self.save_cookies: self.cookie_file = os.path.expanduser("~/.codereview_upload_cookies") - self.cookie_jar = cookielib.MozillaCookieJar(self.cookie_file) + self.cookie_jar = http.cookiejar.MozillaCookieJar(self.cookie_file) if os.path.exists(self.cookie_file): try: self.cookie_jar.load() self.authenticated = True StatusUpdate("Loaded authentication cookies from %s" % self.cookie_file) - except (cookielib.LoadError, IOError): + except (http.cookiejar.LoadError, IOError): # Failed to load cookies - just ignore them. pass else: # Create an empty cookie file with mode 600 - fd = os.open(self.cookie_file, os.O_CREAT, 0600) + fd = os.open(self.cookie_file, os.O_CREAT, 0o600) os.close(fd) # Always chmod the cookie file - os.chmod(self.cookie_file, 0600) + os.chmod(self.cookie_file, 0o600) else: # Don't save cookies across runs of update.py. - self.cookie_jar = cookielib.CookieJar() - opener.add_handler(urllib2.HTTPCookieProcessor(self.cookie_jar)) + self.cookie_jar = http.cookiejar.CookieJar() + opener.add_handler(urllib.request.HTTPCookieProcessor(self.cookie_jar)) return opener @@ -605,7 +605,7 @@ line = p.stdout.readline() if not line: break - print line.strip("\n") + print(line.strip("\n")) output_array.append(line) output = "".join(output_array) else: @@ -613,7 +613,7 @@ p.wait() errout = p.stderr.read() if print_output and errout: - print >>sys.stderr, errout + print(errout, file=sys.stderr) p.stdout.close() p.stderr.close() return output, p.returncode @@ -659,11 +659,11 @@ """Show an "are you sure?" prompt if there are unknown files.""" unknown_files = self.GetUnknownFiles() if unknown_files: - print "The following files are not added to version control:" + print("The following files are not added to version control:") for line in unknown_files: - print line + print(line) prompt = "Are you sure to continue?(y/N) " - answer = raw_input(prompt).strip() + answer = input(prompt).strip() if answer != "y": ErrorExit("User aborted") @@ -715,13 +715,13 @@ else: type = "current" if len(content) > MAX_UPLOAD_SIZE: - print ("Not uploading the %s file for %s because it's too large." % - (type, filename)) + print(("Not uploading the %s file for %s because it's too large." % + (type, filename))) file_too_large = True content = "" checksum = md5(content).hexdigest() if options.verbose > 0 and not file_too_large: - print "Uploading %s file for %s" % (type, filename) + print("Uploading %s file for %s" % (type, filename)) url = "/%d/upload_content/%d/%d" % (int(issue), int(patchset), file_id) form_fields = [("filename", filename), ("status", status), @@ -743,7 +743,7 @@ patches = dict() [patches.setdefault(v, k) for k, v in patch_list] - for filename in patches.keys(): + for filename in list(patches.keys()): base_content, new_content, is_binary, status = files[filename] file_id_str = patches.get(filename) if file_id_str.find("nobase") != -1: @@ -810,8 +810,8 @@ words = line.split() if len(words) == 2 and words[0] == "URL:": url = words[1] - scheme, netloc, path, params, query, fragment = urlparse.urlparse(url) - username, netloc = urllib.splituser(netloc) + scheme, netloc, path, params, query, fragment = urllib.parse.urlparse(url) + username, netloc = urllib.parse.splituser(netloc) if username: logging.info("Removed username from base URL") if netloc.endswith("svn.python.org"): @@ -829,12 +829,12 @@ logging.info("Guessed CollabNet base = %s", base) elif netloc.endswith(".googlecode.com"): path = path + "/" - base = urlparse.urlunparse(("http", netloc, path, params, + base = urllib.parse.urlunparse(("http", netloc, path, params, query, fragment)) logging.info("Guessed Google Code base = %s", base) else: path = path + "/" - base = urlparse.urlunparse((scheme, netloc, path, params, + base = urllib.parse.urlunparse((scheme, netloc, path, params, query, fragment)) logging.info("Guessed base = %s", base) return base @@ -1320,8 +1320,8 @@ rv = [] for patch in patches: if len(patch[1]) > MAX_UPLOAD_SIZE: - print ("Not uploading the patch for " + patch[0] + - " because the file is too large.") + print(("Not uploading the patch for " + patch[0] + + " because the file is too large.")) continue form_fields = [("filename", patch[0])] if not options.download_base: @@ -1329,7 +1329,7 @@ files = [("data", "data.diff", patch[1])] ctype, body = EncodeMultipartFormData(form_fields, files) url = "/%d/upload_patch/%d" % (int(issue), int(patchset)) - print "Uploading patch for " + patch[0] + print("Uploading patch for " + patch[0]) response_body = rpc_server.Send(url, body, content_type=ctype) lines = response_body.splitlines() if not lines or lines[0] != "OK": @@ -1358,7 +1358,8 @@ out, returncode = RunShellWithReturnCode(["hg", "root"]) if returncode == 0: return (VCS_MERCURIAL, out.strip()) - except OSError, (errno, message): + except OSError as xxx_todo_changeme: + (errno, message) = xxx_todo_changeme.args if errno != 2: # ENOENT -- they don't have hg installed. raise @@ -1374,7 +1375,8 @@ "--is-inside-work-tree"]) if returncode == 0: return (VCS_GIT, None) - except OSError, (errno, message): + except OSError as xxx_todo_changeme1: + (errno, message) = xxx_todo_changeme1.args if errno != 2: # ENOENT -- they don't have git installed. raise @@ -1450,7 +1452,7 @@ subversion_config = os.path.expanduser("~/.subversion/config") if not os.path.exists(subversion_config): return {} - config = ConfigParser.ConfigParser() + config = configparser.ConfigParser() config.read(subversion_config) if (config.has_section("miscellany") and config.has_option("miscellany", "enable-auto-props") and @@ -1505,7 +1507,7 @@ svn_auto_props_map = LoadSubversionAutoProperties() all_props = [] - for file_pattern, props in svn_auto_props_map.items(): + for file_pattern, props in list(svn_auto_props_map.items()): if fnmatch.fnmatch(filename, file_pattern): all_props.extend(props) if all_props: @@ -1575,8 +1577,8 @@ guessed_base = vcs.GuessBase(options.download_base) if base: if guessed_base and base != guessed_base: - print "Using base URL \"%s\" from --base_url instead of \"%s\"" % \ - (base, guessed_base) + print("Using base URL \"%s\" from --base_url instead of \"%s\"" % \ + (base, guessed_base)) else: base = guessed_base @@ -1589,12 +1591,12 @@ data = vcs.GenerateDiff(args) files = vcs.GetBaseFiles(data) if verbosity >= 1: - print "Upload server:", options.server, "(change with -s/--server)" + print("Upload server:", options.server, "(change with -s/--server)") if options.issue: prompt = "Message describing this patch set: " else: prompt = "New issue subject: " - message = options.message or raw_input(prompt).strip() + message = options.message or input(prompt).strip() if not message: ErrorExit("A non-empty message is required") rpc_server = GetRpcServer(options) @@ -1625,7 +1627,7 @@ # Send a hash of all the base file so the server can determine if a copy # already exists in an earlier patchset. base_hashes = "" - for file, info in files.iteritems(): + for file, info in files.items(): if not info[0] is None: checksum = md5(info[0]).hexdigest() if base_hashes: @@ -1634,7 +1636,7 @@ form_fields.append(("base_hashes", base_hashes)) if options.private: if options.issue: - print "Warning: Private flag ignored when updating an existing issue." + print("Warning: Private flag ignored when updating an existing issue.") else: form_fields.append(("private", "1")) # If we're uploading base files, don't send the email before the uploads, so @@ -1644,7 +1646,7 @@ if not options.download_base: form_fields.append(("content_upload", "1")) if len(data) > MAX_UPLOAD_SIZE: - print "Patch is large, so uploading file patches separately." + print("Patch is large, so uploading file patches separately.") uploaded_diff_file = [] foRefactoringTool: Refactored ./tests/run_service_tests.py RefactoringTool: Refactored ./tests/run_data_tests.py rm_fields.append(("separate_patches", "1")) else: @@ -1684,7 +1686,7 @@ try: RealMain(sys.argv) except KeyboardInterrupt: - print + print() StatusUpdate("Interrupted.") sys.exit(1) --- ./tests/run_service_tests.py (original) +++ ./tests/run_service_tests.py (refactored) @@ -2,24 +2,24 @@ import sys import unittest -import module_test_runner +from . import module_test_runner import getopt import getpass # Modules whose tests we will run. -import atom_tests.service_test -import gdata_tests.service_test -import gdata_tests.apps.service_test -import gdata_tests.calendar.service_test -import gdata_tests.docs.service_test -import gdata_tests.health.service_test -import gdata_tests.spreadsheet.service_test -import gdata_tests.spreadsheet.text_db_test -import gdata_tests.photos.service_test -import gdata_tests.contacts.service_test -import gdata_tests.blogger.service_test -import gdata_tests.youtube.service_test -import gdata_tests.contacts.profiles.service_test +from . import atom_tests.service_test +from . import gdata_tests.service_test +from . import gdata_tests.apps.service_test +from . import gdata_tests.calendar.service_test +from . import gdata_tests.docs.service_test +from . import gdata_tests.health.service_test +from . import gdata_tests.spreadsheet.service_test +from . import gdata_tests.spreadsheet.text_db_test +from . import gdata_tests.photos.service_test +from . import gdata_tests.contacts.service_test +from . import gdata_tests.blogger.service_test +from . import gdata_tests.youtube.service_test +from . import gdata_tests.contacts.profiles.service_test def RunAllTests(username, password, spreadsheet_key, worksheet_key, @@ -85,21 +85,21 @@ print ('Missing --user and --pw command line arguments, ' 'prompting for credentials.') if username == '': - username = raw_input('Please enter your username: ') + username = input('Please enter your username: ') if password == '': password = getpass.getpass() if spreadsheet_key == '': - spreadsheet_key = raw_input( + spreadsheet_key = input( 'Please enter the key for the test spreadsheet: ') if worksheet_key == '': - worksheet_key = raw_input( + worksheet_key = input( 'Please enter the id for the worksheet to be edited: ') if apps_username == '': - apps_username = raw_input('Please enter your Google Apps admin username: ') + apps_username = input('Please enter your Google Apps admin username: ') if apps_password == '': apps_password = getpass.getpass() if apps_domain == '': - apps_domain = raw_input('Please enter your Google Apps domain: ') + apps_domain = input('Please enter your Google Apps domain: ') RunAllTests(username, password, spreadsheet_key, worksheet_key, apps_username, apps_password, apps_domain) --- ./tests/run_data_tests.py (original) +++ ./tests/run_data_tests.py (refactored) @@ -2,33 +2,33 @@ import sys import unittest -import module_test_runner +from . import module_test_runner import getopt import getpass # Modules whose tests we will run. -import gdata_test -import atom_test -import atom_tests.http_interface_test -import atom_tests.mock_http_test -import atom_tests.token_store_test -import atom_tests.url_test -import atom_tests.core_test -import gdata_tests.apps.emailsettings.data_test -import gdata_tests.apps.multidomain.data_test -import gdata_tests.apps_test -import gdata_tests.auth_test -import gdata_tests.blogger_test -import gdata_tests.calendar_test -import gdata_tests.calendar_resource.data_test -import gdata_tests.client_test -import gdata_tests.codesearch_test -import gdata_tests.contacts_test -import gdata_tests.docs_test -import gdata_tests.photos_test -import gdata_tests.spreadsheet_test -import gdata_tests.youtube_test -import gdata_tests.webmastertools_test -import gdata_tests.oauth.data_test +from . import gdata_test +from . import atom_test +from . import atom_tests.http_interface_test +from . import atom_tests.mock_http_test +from . import atom_tests.token_store_test +fromRefactoringTool: Refactored ./tests/run_all_tests.py RefactoringTool: Refactored ./tests/module_test_runner.py RefactoringTool: Refactored ./tests/gdata_tests/youtube_test.py . import atom_tests.url_test +from . import atom_tests.core_test +from . import gdata_tests.apps.emailsettings.data_test +from . import gdata_tests.apps.multidomain.data_test +from . import gdata_tests.apps_test +from . import gdata_tests.auth_test +from . import gdata_tests.blogger_test +from . import gdata_tests.calendar_test +from . import gdata_tests.calendar_resource.data_test +from . import gdata_tests.client_test +from . import gdata_tests.codesearch_test +from . import gdata_tests.contacts_test +from . import gdata_tests.docs_test +from . import gdata_tests.photos_test +from . import gdata_tests.spreadsheet_test +from . import gdata_tests.youtube_test +from . import gdata_tests.webmastertools_test +from . import gdata_tests.oauth.data_test def RunAllTests(): --- ./tests/run_all_tests.py (original) +++ ./tests/run_all_tests.py (refactored) @@ -22,9 +22,9 @@ import unittest import getopt import getpass -import module_test_runner -import run_data_tests -import run_service_tests +from . import module_test_runner +from . import run_data_tests +from . import run_service_tests if __name__ == '__main__': --- ./tests/module_test_runner.py (original) +++ ./tests/module_test_runner.py (refactored) @@ -44,7 +44,7 @@ runner = unittest.TextTestRunner(verbosity=2) for module in self.modules: # Set any module variables according to the contents in the settings - for setting, value in self.settings.iteritems(): + for setting, value in self.settings.items(): try: setattr(module, setting, value) except AttributeError: --- ./tests/gdata_tests/youtube_test.py (original) +++ ./tests/gdata_tests/youtube_test.py (refactored) @@ -34,141 +34,141 @@ test_data.YOUTUBE_VIDEO_FEED) def testCorrectXmlParsing(self): - self.assertEquals(self.video_feed.id.text, + self.assertEqual(self.video_feed.id.text, 'http://gdata.youtube.com/feeds/api/standardfeeds/top_rated') - self.assertEquals(len(self.video_feed.entry), 2) + self.assertEqual(len(self.video_feed.entry), 2) for entry in self.video_feed.entry: if (entry.id.text == 'http://gdata.youtube.com/feeds/api/videos/C71ypXYGho8'): - self.assertEquals(entry.published.text, '2008-03-20T10:17:27.000-07:00') - self.assertEquals(entry.updated.text, '2008-05-14T04:26:37.000-07:00') - self.assertEquals(entry.category[0].scheme, + self.assertEqual(entry.published.text, '2008-03-20T10:17:27.000-07:00') + self.assertEqual(entry.updated.text, '2008-05-14T04:26:37.000-07:00') + self.assertEqual(entry.category[0].scheme, 'http://gdata.youtube.com/schemas/2007/keywords.cat') - self.assertEquals(entry.category[0].term, 'karyn') - self.assertEquals(entry.category[1].scheme, + self.assertEqual(entry.category[0].term, 'karyn') + self.assertEqual(entry.category[1].scheme, 'http://gdata.youtube.com/schemas/2007/keywords.cat') - self.assertEquals(entry.category[1].term, 'garcia') - self.assertEquals(entry.category[2].scheme, + self.assertEqual(entry.category[1].term, 'garcia') + self.assertEqual(entry.category[2].scheme, 'http://gdata.youtube.com/schemas/2007/keywords.cat') - self.assertEquals(entry.category[2].term, 'me') - self.assertEquals(entry.category[3].scheme, + self.assertEqual(entry.category[2].term, 'me') + self.assertEqual(entry.category[3].scheme, 'http://schemas.google.com/g/2005#kind') - self.assertEquals(entry.category[3].term, + self.assertEqual(entry.category[3].term, 'http://gdata.youtube.com/schemas/2007#video') - self.assertEquals(entry.title.text, + self.assertEqual(entry.title.text, 'Me odeio por te amar - KARYN GARCIA') - self.assertEquals(entry.content.text, 'http://www.karyngarcia.com.br') - self.assertEquals(entry.link[0].rel, 'alternate') - self.assertEquals(entry.link[0].href, + self.assertEqual(entry.content.text, 'http://www.karyngarcia.com.br') + self.assertEqual(entry.link[0].rel, 'alternate') + self.assertEqual(entry.link[0].href, 'http://www.youtube.com/watch?v=C71ypXYGho8') - self.assertEquals(entry.link[1].rel, + self.assertEqual(entry.link[1].rel, 'http://gdata.youtube.com/schemas/2007#video.related') - self.assertEquals(entry.link[1].href, + self.assertEqual(entry.link[1].href, 'http://gdata.youtube.com/feeds/api/videos/C71ypXYGho8/related') - self.assertEquals(entry.link[2].rel, 'self') - self.assertEquals(entry.link[2].href, + self.assertEqual(entry.link[2].rel, 'self') + self.assertEqual(entry.link[2].href, ('http://gdata.youtube.com/feeds/api/standardfeeds' '/top_rated/C71ypXYGho8')) - self.assertEquals(entry.author[0].name.text, 'TvKarynGarcia') - self.assertEquals(entry.author[0].uri.text, + self.assertEqual(entry.author[0].name.text, 'TvKarynGarcia') + self.assertEqual(entry.author[0].uri.text, 'http://gdata.youtube.com/feeds/api/users/tvkaryngarcia') - self.assertEquals(entry.media.title.text, + self.assertEqual(entry.media.title.text, 'Me odeio por te amar - KARYN GARCIA') - self.assertEquals(entry.media.description.text, + self.assertEqual(entry.media.description.text, 'http://www.karyngarcia.com.br') - self.assertEquals(entry.media.keywords.text, + self.assertEqual(entry.media.keywords.text, 'amar, boyfriend, garcia, karyn, me, odeio, por, te') - self.assertEquals(entry.media.duration.seconds, '203') - self.assertEquals(entry.media.category[0].label, 'Music') - self.assertEquals(entry.media.category[0].scheme, + self.assertEqual(entry.media.duration.seconds, '203') + self.assertEqual(entry.media.category[0].label, 'Music') + self.assertEqual(entry.media.category[0].scheme, 'http://gdata.youtube.com/schemas/2007/categories.cat') - self.assertEquals(entry.media.category[0].text, 'Music') - self.assertEquals(entry.media.category[1].label, 'test111') - self.assertEquals(entry.media.category[1].scheme, + self.assertEqual(entry.media.category[0].text, 'Music') + self.assertEqual(entry.media.category[1].label, 'test111') + self.assertEqual(entry.media.category[1].scheme, 'http://gdata.youtube.com/schemas/2007/developertags.cat') - self.assertEquals(entry.media.category[1].text, 'test111') - self.assertEquals(entry.media.category[2].label, 'test222') - self.assertEquals(entry.media.category[2].scheme, + self.assertEqual(entry.media.category[1].text, 'test111') + self.assertEqual(entry.media.category[2].label, 'test222') + self.assertEqual(entry.media.category[2].scheme, 'http://gdata.youtube.com/schemas/2007/developertags.cat') - self.assertEquals(entry.media.category[2].text, 'test222') - self.assertEquals(entry.media.content[0].url, + self.assertEqual(entry.media.category[2].text, 'test222') + self.assertEqual(entry.media.content[0].url, 'http://www.youtube.com/v/C71ypXYGho8') - self.assertEquals(entry.media.content[0].type, + self.assertEqual(entry.media.content[0].type, 'application/x-shockwave-flash') - self.assertEquals(entry.media.content[0].medium, 'video') - self.assertEquals( + self.assertEqual(entry.media.content[0].medium, 'video') + self.assertEqual( entry.media.content[0].extension_attributes['isDefault'], 'true') - self.assertEquals( + self.assertEqual( entry.media.content[0].extension_attributes['expression'], 'full') - self.assertEquals( + self.assertEqual( entry.media.content[0].extension_attributes['duration'], '203') - self.assertEquals( + self.assertEqual( entry.media.content[0].extension_attributes[YT_FORMAT], '5') - self.assertEquals(entry.media.content[1].url, + self.assertEqual(entry.media.content[1].url, ('rtsp://rtsp2.youtube.com/ChoLENy73wIaEQmPhgZ2pXK9CxMYDSANFEgGDA' '==/0/0/0/video.3gp')) - self.assertEquals(entry.media.content[1].type, 'video/3gpp') - self.assertEquals(entry.media.content[1].medium, 'video') - self.assertEquals( + self.assertEqual(entry.media.content[1].type, 'video/3gpp') + self.assertEqual(entry.media.content[1].medium, 'video') + self.assertEqual( entry.media.content[1].extension_attributes['expression'], 'full') - self.assertEquals( + self.assertEqual( entry.media.content[1].extension_attributes['duration'], '203') - self.assertEquals( + self.assertEqual( entry.media.content[1].extension_attributes[YT_FORMAT], '1') - self.assertEquals(entry.media.content[2].url, + self.assertEqual(entry.media.content[2].url, ('rtsp://rtsp2.youtube.com/ChoLENy73wIaEQmPhgZ2pXK9CxMYESARFEgGDA==' '/0/0/0/video.3gp')) - self.assertEquals(entry.media.content[2].type, 'video/3gpp') - self.assertEquals(entry.media.content[2].medium, 'video') - self.assertEquals( + self.assertEqual(entry.media.content[2].type, 'video/3gpp') + self.assertEqual(entry.media.content[2].medium, 'video') + self.assertEqual( entry.media.content[2].extension_attributes['expression'], 'full') - self.assertEquals( + self.assertEqual( entry.media.content[2].extension_attributes['duration'], '203') - self.assertEquals( + self.assertEqual( entry.media.content[2].extension_attributes[YT_FORMAT], '6') - self.assertEquals(entry.media.player.url, + self.assertEqual(entry.media.player.url, 'http://www.youtube.com/watch?v=C71ypXYGho8') - self.assertEquals(entry.media.thumbnail[0].url, + self.assertEqual(entry.media.thumbnail[0].url, 'http://img.youtube.com/vi/C71ypXYGho8/2.jpg') - self.assertEquals(entry.media.thumbnail[0].height, '97') - self.assertEquals(entry.media.thumbnail[0].width, '130') - self.assertEquals(entry.media.thumbnail[0].extension_attributes['time'], + self.assertEqual(entry.media.thumbnail[0].height, '97') + self.assertEqual(entry.media.thumbnail[0].width, '130') + self.assertEqual(entry.media.thumbnail[0].extension_attributes['time'], '00:01:41.500') - self.assertEquals(entry.media.thumbnail[1].url, + self.assertEqual(entry.media.thumbnail[1].url, 'http://img.youtube.com/vi/C71ypXYGho8/1.jpg') - self.assertEquals(entry.media.thumbnail[1].height, '97') - self.assertEquals(entry.media.thumbnail[1].width, '130') - self.assertEquals(entry.media.thumbnail[1].extension_attributes['time'], + self.assertEqual(entry.media.thumbnail[1].height, '97') + self.assertEqual(entry.media.thumbnail[1].width, '130') + self.assertEqual(entry.media.thumbnail[1].extension_attributes['time'], '00:00:50.750') - self.assertEquals(entry.media.thumbnail[2].url, + self.assertEqual(entry.media.thumbnail[2].url, 'http://img.youtube.com/vi/C71ypXYGho8/3.jpg') - self.assertEquals(entry.media.thumbnail[2].height, '97') - self.assertEquals(entry.media.thumbnail[2].width, '130') - self.assertEquals(entry.media.thumbnail[2].extension_attributes['time'], + self.assertEqual(entry.media.thumbnail[2].height, '97') + self.assertEqual(entry.media.thumbnail[2].width, '130') + self.assertEqual(entry.media.thumbnail[2].extension_attributes['time'], '00:02:32.250') - self.assertEquals(entry.media.thumbnail[3].url, + self.assertEqual(entry.media.thumbnail[3].url, 'http://img.youtube.com/vi/C71ypXYGho8/0.jpg') - self.assertEquals(entry.media.thumbnail[3].height, '240') - self.assertEquals(entry.media.thumbnail[3].width, '320') - self.assertEquals(entry.media.thumbnail[3].extension_attributes['time'], + self.assertEqual(entry.media.thumbnail[3].height, '240') + self.assertEqual(entry.media.thumbnail[3].width, '320') + self.assertEqual(entry.media.thumbnail[3].extension_attributes['time'], '00:01:41.500') - self.assertEquals(entry.statistics.view_count, '138864') - self.assertEquals(entry.statistics.favorite_count, '2474') - self.assertEquals(entry.rating.min, '1') - self.assertEquals(entry.rating.max, '5') - self.assertEquals(entry.rating.num_raters, '4626') - self.assertEquals(entry.rating.average, '4.95') - self.assertEquals(entry.comments.feed_link[0].href, + self.assertEqual(entry.statistics.view_count, '138864') + self.assertEqual(entry.statistics.favorite_count, '2474') + self.assertEqual(entry.rating.min, '1') + self.assertEqual(entry.rating.max, '5') + self.assertEqual(entry.rating.num_raters, '4626') + self.assertEqual(entry.rating.average, '4.95') + self.assertEqual(entry.comments.feed_link[0].href, ('http://gdata.youtube.com/feeds/api/videos/' 'C71ypXYGho8/comments')) - self.assertEquals(entry.comments.feed_link[0].count_hint, '27') - - self.assertEquals(entry.GetSwfUrl(), + self.assertEqual(entry.comments.feed_link[0].count_hint, '27') + + self.assertEqual(entry.GetSwfUrl(), 'http://www.youtube.com/v/C71ypXYGho8') - self.assertEquals(entry.GetYouTubeCategoryAsString(), 'Music') + self.assertEqual(entry.GetYouTubeCategoryAsString(), 'Music') class VideoEntryPrivateTest(unittest.TestCase): @@ -178,9 +178,9 @@ test_data.YOUTUBE_ENTRY_PRIVATE) def testCorrectXmlParsing(self): - self.assert_(isinstance(self.entry, + self.assertTrue(isinstance(self.entry, gdata.youtube.YouTubeVideoEntry)) - self.assert_(self.entry.media.private) + self.assertTrue(self.entry.media.private) class VideoFeedTest(unittest.TestCase): @@ -190,39 +190,39 @@ test_data.YOUTUBE_VIDEO_FEED) def testCorrectXmlParsing(self): - self.assertEquals(self.feed.id.text, + self.assertEqual(self.feed.id.text, 'http://gdata.youtube.com/feeds/api/standardfeeds/top_rated') - self.assertEquals(self.feed.generator.text, 'YouTube data API') - self.assertEquals(self.feed.generator.uri, 'http://gdata.youtube.com/') - self.assertEquals(len(self.feed.author), 1) - self.assertEquals(self.feed.author[0].name.text, 'YouTube') - self.assertEquals(len(self.feed.category), 1) - self.assertEquals(self.feed.category[0].scheme, + self.assertEqual(self.feed.generator.text, 'YouTube data API') + self.assertEqual(self.feed.generator.uri, 'http://gdata.youtube.com/') + self.assertEqual(len(self.feed.author), 1) + self.assertEqual(self.feed.author[0].name.text, 'YouTube') + self.assertEqual(len(self.feed.category), 1) + self.assertEqual(self.feed.category[0].scheme, 'http://schemas.google.com/g/2005#kind') - self.assertEquals(self.feed.category[0].term, + self.assertEqual(self.feed.category[0].term, 'http://gdata.youtube.com/schemas/2007#video') - self.assertEquals(self.feed.items_per_page.text, '25') - self.assertEquals(len(self.feed.link), 4) - self.assertEquals(self.feed.link[0].href, + self.assertEqual(self.feed.items_per_page.text, '25') + self.assertEqual(len(self.feed.link), 4) + self.assertEqual(self.feed.link[0].href, 'http://www.youtube.com/browse?s=tr') - self.assertEquals(self.feed.link[0].rel, 'alternate') - self.assertEquals(self.feed.link[1].href, + self.assertEqual(self.feed.link[0].rel, 'alternate') + self.assertEqual(self.feed.link[1].href, 'http://gdata.youtube.com/feeds/api/standardfeeds/top_rated') - self.assertEquals(self.feed.link[1].rel, + self.assertEqual(self.feed.link[1].rel, 'http://schemas.google.com/g/2005#feed') - self.assertEquals(self.feed.link[2].href, + self.assertEqual(self.feed.link[2].href, ('http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?' 'start-index=1&max-results=25')) - self.assertEquals(self.feed.link[2].rel, 'self') - self.assertEquals(self.feed.link[3].href, + self.assertEqual(self.feed.link[2].rel, 'self') + self.assertEqual(self.feed.link[3].href, ('http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?' 'start-index=26&max-results=25')) - self.assertEquals(self.feed.link[3].rel, 'next') - self.assertEquals(self.feed.start_index.text, '1') - self.assertEquals(self.feed.title.text, 'Top Rated') - self.assertEquals(self.feed.total_results.text, '100') - self.assertEquals(self.feed.updated.text, '2008-05-14T02:24:07.000-07:00') - self.assertEquals(len(self.feed.entry), 2) + self.assertEqual(self.feed.link[3].rel, 'next') + self.assertEqual(self.feed.start_index.text, '1') + self.assertEqual(self.feed.title.text, 'Top Rated') + self.assertEqual(self.feed.total_results.text, '100') + self.assertEqual(self.feed.updated.text, '2008-05-14T02:24:07.000-07:00') + self.assertEqual(len(self.feed.entry), 2) class YouTubePlaylistFeedTest(unittest.TestCase): @@ -232,10 +232,10 @@ test_data.YOUTUBE_PLAYLIST_FEED) def testCorrectXmlParsing(self): - self.assertEquals(len(self.feed.entry), 1) - self.assertEquals( + self.assertEqual(len(self.feed.entry), 1) + self.assertEqual( self.feed.category[0].scheme, 'http://schemas.google.com/g/2005#kind') - self.assertEquals(self.feed.category[0].term, + self.assertEqual(self.feed.category[0].term, 'http://gdata.youtube.com/schemas/2007#playlistLink') @@ -247,15 +247,15 @@ def testCorrectXmlParsing(self): for entry in self.feed.entry: - self.assertEquals(entry.category[0].scheme, + self.assertEqual(entry.category[0].scheme, 'http://schemas.google.com/g/2005#kind') - self.assertEquals(entry.category[0].term, + self.assertEqual(entry.category[0].term, 'http://gdata.youtube.com/schemas/2007#playlistLink') - self.assertEquals(entry.description.text, + self.assertEqual(entry.description.text, 'My new playlist Description') - self.assertEquals(entry.feed_link[0].href, + self.assertEqual(entry.feed_link[0].href, 'http://gdata.youtube.com/feeds/playlists/8BCDD04DE8F771B2') - self.assertEquals(entry.feed_link[0].rel, + self.assertEqual(entry.feed_link[0].rel, 'http://gdata.youtube.com/schemas/2007#playlist') @@ -266,17 +266,17 @@ test_data.YOUTUBE_PLAYLIST_VIDEO_FEED) def testCorrectXmlParsing(self): - self.assertEquals(len(self.feed.entry), 1) - self.assertEquals(self.feed.category[0].scheme, + self.assertEqual(len(self.feed.entry), 1) + self.assertEqual(self.feed.category[0].scheme, 'http://schemas.google.com/g/2005#kind') - self.assertEquals(self.feed.category[0].term, + self.assertEqual(self.feed.category[0].term, 'http://gdata.youtube.com/schemas/2007#playlist') - self.assertEquals(self.feed.category[1].scheme, + self.assertEqual(self.feed.category[1].scheme, 'http://gdata.youtube.com/schemas/2007/tags.cat') - self.assertEquals(self.feed.category[1].term, 'videos') - self.assertEquals(self.feed.category[2].scheme, + self.assertEqual(self.feed.category[1].term, 'videos') + self.assertEqual(self.feed.category[2].scheme, 'http://gdata.youtube.com/schemas/2007/tags.cat') - self.assertEquals(self.feed.category[2].term, 'python') + self.assertEqual(self.feed.category[2].term, 'python') class YouTubePlaylistVideoEntryTest(unittest.TestCase): @@ -286,9 +286,9 @@ test_data.YOUTUBE_PLAYLIST_VIDEO_FEED) def testCorrectXmlParsing(self): - self.assertEquals(len(self.feed.entry), 1) + self.assertEqual(len(self.feed.entry), 1) for entry in self.feed.entry: - self.assertEquals(entry.position.text, '1') + self.assertEqual(entry.position.text, '1') class YouTubeVideoCommentFeedTest(unittest.TestCase): @@ -298,27 +298,27 @@ test_data.YOUTUBE_COMMENT_FEED) def testCorrectXmlParsing(self): - self.assertEquals(len(self.feed.category), 1) - self.assertEquals(self.feed.category[0].scheme, + self.assertEqual(len(self.feed.category), 1) + self.assertEqual(self.feed.category[0].scheme, 'http://schemas.google.com/g/2005#kind') - self.assertEquals(self.feed.category[0].term, + self.assertEqual(self.feed.category[0].term, 'http://gdata.youtube.com/schemas/2007#comment') - self.assertEquals(len(self.feed.link), 4) - self.assertEquals(self.feed.link[0].rel, 'related') - self.assertEquals(self.feed.link[0].href, + self.assertEqual(len(self.feed.link), 4) + self.assertEqual(self.feed.link[0].rel, 'related') + self.assertEqual(self.feed.link[0].href, 'http://gdata.youtube.com/feeds/videos/2Idhz9ef5oU') - self.assertEquals(self.feed.link[1].rel, 'alternate') - self.assertEquals(self.feed.link[1].href, + self.assertEqual(self.feed.link[1].rel, 'alternate') + self.assertEqual(self.feed.link[1].href, 'http://www.youtube.com/watch?v=2Idhz9ef5oU') - self.assertEquals(self.feed.link[2].rel, + self.assertEqual(self.feed.link[2].rel, 'http://schemas.google.com/g/2005#feed') - self.assertEquals(self.feed.link[2].href, + self.assertEqual(self.feed.link[2].href, 'http://gdata.youtube.com/feeds/videos/2Idhz9ef5oU/comments') - self.assertEquals(self.feed.link[3].rel, 'self') - self.assertEquals(self.feed.link[3].href, + self.assertEqual(self.feed.link[3].rel, 'self') + self.assertEqual(self.feed.link[3].href, ('http://gdata.youtube.com/feeds/videos/2Idhz9ef5oU/comments?' 'start-index=1&max-results=25')) - self.assertEquals(len(self.feed.entry), 3) + self.assertEqual(len(self.feed.entry), 3) class YouTubeVideoCommentEntryTest(unittest.TestCase): @@ -328,22 +328,22 @@ test_data.YOUTUBE_COMMENT_FEED) def testCorrectXmlParsing(self): - self.assertEquals(len(self.feed.entry), 3) - self.assert_(isinstance(self.feed.entry[0], + self.assertEqual(len(self.feed.entry), 3) + self.assertTrue(isinstance(self.feed.entry[0], gdata.youtube.YouTubeVideoCommentEntry)) for entry in self.feed.entry: if (entry.id.text == ('http://gdata.youtube.com/feeds/videos/' '2Idhz9ef5oU/comments/91F809A3DE2EB81B')): - self.assertEquals(entry.category[0].scheme, + self.assertEqual(entry.category[0].scheme, 'http://schemas.google.com/g/2005#kind') - self.assertEquals(entry.category[0].term, + self.assertEqual(entry.category[0].term, 'http://gdata.youtube.com/schemas/2007#comment') - self.assertEquals(entry.link[0].href, + self.assertEqual(entry.link[0].href, 'http://gdata.youtube.com/feeds/videos/2Idhz9ef5oU') - self.assertEquals(entry.link[0].rel, 'related') - self.assertEquals(entry.content.text, 'test66') + self.assertEqual(entry.link[0].rel, 'related') + self.assertEqual(entry.content.text, 'test66') class YouTubeVideoSubscriptionFeedTest(unittest.TestCase): @@ -354,27 +354,27 @@ def testCorrectXmlParsing(self): - self.assertEquals(len(self.feed.category), 1) - self.assertEquals(self.feed.category[0].scheme, + self.assertEqual(len(self.feed.category), 1) + self.assertEqual(self.feed.category[0].scheme, 'http://schemas.google.com/g/2005#kind') - self.assertEquals(self.feed.category[0].term, + self.assertEqual(self.feed.category[0].term, 'http://gdata.youtube.com/schemas/2007#subscription') - self.assertEquals(len(self.feed.link), 4) - self.assertEquals(self.feed.link[0].rel, 'related') - self.assertEquals(self.feed.link[0].href, + self.assertEqual(len(self.feed.link), 4) + self.assertEqual(self.feed.link[0].rel, 'related') + self.assertEqual(self.feed.link[0].href, 'http://gdata.youtube.com/feeds/users/andyland74') - self.assertEquals(self.feed.link[1].rel, 'alternate') - self.assertEquals(self.feed.link[1].href, + self.assertEqual(self.feed.link[1].rel, 'alternate') + self.assertEqual(self.feed.link[1].href, 'http://www.youtube.com/profile_subscriptions?user=andyland74') - self.assertEquals(self.feed.link[2].rel, + self.assertEqual(self.feed.link[2].rel, 'http://schemas.google.com/g/2005#feed') - self.assertEquals(self.feed.link[2].href, + self.assertEqual(self.feed.link[2].href, 'http://gdata.youtube.com/feeds/users/andyland74/subscriptions') - self.assertEquals(self.feed.link[3].rel, 'self') - self.assertEquals(self.feed.link[3].href, + self.assertEqual(self.feed.link[3].rel, 'self') + self.assertEqual(self.feed.link[3].href, ('http://gdata.youtube.com/feeds/users/andyland74/subscriptions?' 'start-index=1&max-results=25')) - self.assertEquals(len(self.feed.entry), 1) + self.assertEqual(len(self.feed.entry), 1) class YouTubeVideoSubscriptionEntryTest(unittest.TestCase): @@ -385,31 +385,31 @@ def testCorrectXmlParsing(self): for entry in self.feed.entry: - self.assertEquals(len(entry.category), 2) - self.assertEquals(entry.category[0].scheme, + self.assertEqual(len(entry.category), 2) + self.assertEqual(entry.category[0].scheme, 'http://gdata.youtube.com/schemas/2007/subscriptiontypes.cat') - self.assertEquals(entry.category[0].term, 'channel') - self.assertEquals(entry.category[1].scheme, + self.assertEqual(entry.category[0].term, 'channel') + self.assertEqual(entry.category[1].scheme, 'http://schemas.google.com/g/2005#kind') - self.assertEquals(entry.category[1].term, + self.assertEqual(entry.category[1].term, 'http://gdata.youtube.com/schemas/2007#subscription') - self.assertEquals(len(entry.link), 3) - self.assertEquals(entry.link[0].href, + self.assertEqual(len(entry.link), 3) + self.assertEqual(entry.link[0].href, 'http://gdata.youtube.com/feeds/users/andyland74') - self.assertEquals(entry.link[0].rel, 'related') - self.assertEquals(entry.link[1].href, + self.assertEqual(entry.link[0].rel, 'related') + self.assertEqual(entry.link[1].href, 'http://www.youtube.com/profile_videos?user=NBC') - self.assertEquals(entry.link[1].rel, 'alternate') - self.assertEquals(entry.link[2].href, + self.assertEqual(entry.link[1].rel, 'alternate') + self.assertEqual(entry.link[2].href, ('http://gdata.youtube.com/feeds/users/andyland74/subscriptions/' 'd411759045e2ad8c')) - self.assertEquals(entry.link[2].rel, 'self') - self.assertEquals(len(entry.feed_link), 1) - self.assertEquals(entry.feed_link[0].href, + self.assertEqual(entry.link[2].rel, 'self') + self.assertEqual(len(entry.feed_link), 1) + self.assertEqual(entry.feed_link[0].href, 'http://gdata.youtube.com/feeds/api/users/nbc/uploads') - self.assertEquals(entry.feed_link[0].rel, + self.assertEqual(entry.feed_link[0].rel, 'http://gdata.youtube.com/schemas/2007#user.uploads') - self.assertEquals(entry.username.text, 'NBC') + self.assertEqual(entry.username.text, 'NBC') class YouTubeVideoResponseFeedTest(unittest.TestCase): @@ -419,27 +419,27 @@ test_data.YOUTUBE_VIDEO_RESPONSE_FEED) def testCorrectXmlParsing(self): - self.assertEquals(len(self.feed.category), 1) - self.assertEquals(self.feed.category[0].scheme, + self.assertEqual(len(self.feed.category), 1) + self.assertEqual(self.feed.category[0].scheme, 'http://schemas.google.com/g/2005#kind') - self.assertEquals(self.feed.category[0].term, + self.assertEqual(self.feed.category[0].term, 'http://gdata.youtube.com/schemas/2007#video') - self.assertEquals(len(self.feed.link), 4) - self.assertEquals(self.feed.link[0].href, + self.assertEqual(len(self.feed.link), 4) + self.assertEqual(self.feed.link[0].href, 'http://gdata.youtube.com/feeds/videos/2c3q9K4cHzY') - self.assertEquals(self.feed.link[0].rel, 'related') - self.assertEquals(self.feed.link[1].href, + self.assertEqual(self.feed.link[0].rel, 'related') + self.assertEqual(self.feed.link[1].href, 'http://www.youtube.com/video_response_view_all?v=2c3q9K4cHzY') - self.assertEquals(self.feed.link[1].rel, 'alternate') - self.assertEquals(self.feed.link[2].href, + self.assertEqual(self.feed.link[1].rel, 'alternate') + self.assertEqual(self.feed.link[2].href, 'http://gdata.youtube.com/feeds/videos/2c3q9K4cHzY/responses') - self.assertEquals(self.feed.link[2].rel, + self.assertEqual(self.feed.link[2].rel, 'http://schemas.google.com/g/2005#feed') - self.assertEquals(self.feed.link[3].href, + self.assertEqual(self.feed.link[3].href, ('http://gdata.youtube.com/feeds/videos/2c3q9K4cHzY/responses?' 'start-index=1&max-results=25')) - self.assertEquals(self.feed.link[3].rel, 'self') - self.assertEquals(len(self.feed.entry), 1) + self.assertEqual(self.feed.link[3].rel, 'self') + self.assertEqual(len(self.feed.entry), 1) class YouTubeVideoResponseEntryTest(unittest.TestCase): @@ -450,7 +450,7 @@ def testCorrectXmlParsing(self): for entry in self.feed.entry: - self.assert_(isinstance(entry, gdata.youtube.YouTubeVideoEntry)) + self.assertTrue(isinstance(entry, gdata.youtube.YouTubeVideoEntry)) class YouTubeContactFeed(unittest.TestCase): @@ -460,10 +460,10 @@ test_data.YOUTUBE_CONTACTS_FEED) def testCorrectXmlParsing(self): - self.assertEquals(len(self.feed.entry), 2) - self.assertEquals(self.feed.category[0].scheme, + self.assertEqual(len(self.feed.entry), 2) + self.assertEqual(self.feed.category[0].scheme, 'http://schemas.google.com/g/2005#kind') - self.assertEquals(self.feed.category[0].term, + self.assertEqual(self.feed.category[0].term, 'http://gdata.youtube.com/schemas/2007#friend') @@ -477,8 +477,8 @@ for entry in self.feed.entry: if (entry.id.text == ('http://gdata.youtube.com/feeds/users/' 'apitestjhartmann/contacts/testjfisher')): - self.assertEquals(entry.username.text, 'testjfisher') - self.assertEquals(entry.status.text, 'pending') + self.assertEqual(entry.username.text, 'testjfisher') + self.assertEqual(entry.status.text, 'pending') class YouTubeUserEntry(unittest.TestCase): @@ -488,74 +488,74 @@ test_data.YOUTUBE_PROFILE) def testCorrectXmlParsing(self): - self.assertEquals(self.feed.author[0].name.text, 'andyland74') - self.assertEquals(self.feed.books.text, 'Catch-22') - self.assertEquals(self.feed.category[0].scheme, + self.assertEqual(self.feed.author[0].name.text, 'andyland74') + self.assertEqual(self.feed.books.text, 'Catch-22') + self.assertEqual(self.feed.category[0].scheme, 'http://gdata.youtube.com/schemas/2007/channeltypes.cat') - self.assertEquals(self.feed.category[0].term, 'Standard') - self.assertEquals(self.feed.category[1].scheme, + self.assertEqual(self.feed.category[0].term, 'Standard') + self.assertEqual(self.feed.category[1].scheme, 'http://schemas.google.com/g/2005#kind') - self.assertEquals(self.feed.category[1].term, + self.assertEqual(self.feed.category[1].term, 'http://gdata.youtube.com/schemas/2007#userProfile') - self.assertEquals(self.feed.company.text, 'Google') - self.assertEquals(self.feed.gender.text, 'm') - self.assertEquals(self.feed.hobbies.text, 'Testing YouTube APIs') - self.assertEquals(self.feed.hometown.text, 'Somewhere') - self.assertEquals(len(self.feed.feed_link), 6) - self.assertEquals(self.feed.feed_link[0].count_hint, '4') - self.assertEquals(self.feed.feed_link[0].href, + self.assertEqual(self.feed.company.text, 'Google') + self.assertEqual(self.feed.gender.text, 'm') + self.assertEqual(self.feed.hobbies.text, 'Testing YouTube APIs') + self.assertEqual(self.feed.hometown.text, 'Somewhere') + self.assertEqual(len(self.feed.feed_link), 6) + self.assertEqual(self.feed.feed_link[0].count_hint, '4') + self.assertEqual(self.feed.feed_link[0].href, 'http://gdata.youtube.com/feeds/users/andyland74/favorites') - self.assertEquals(self.feed.feed_link[0].rel, + self.assertEqual(self.feed.feed_link[0].rel, 'http://gdata.youtube.com/schemas/2007#user.favorites') - self.assertEquals(self.feed.feed_link[1].count_hint, '1') - self.assertEquals(self.feed.feed_link[1].href, + self.assertEqual(self.feed.feed_link[1].count_hint, '1') + self.assertEqual(self.feed.feed_link[1].href, 'http://gdata.youtube.com/feeds/users/andyland74/contacts') - self.assertEquals(self.feed.feed_link[1].rel, + self.assertEqual(self.feed.feed_link[1].rel, 'http://gdata.youtube.com/schemas/2007#user.contacts') - self.assertEquals(self.feed.feed_link[2].count_hint, '0') - self.assertEquals(self.feed.feed_link[2].href, + self.assertEqual(self.feed.feed_link[2].count_hint, '0') + self.assertEqual(self.feed.feed_link[2].href, 'http://gdata.youtube.com/feeds/users/andyland74/inbox') - self.assertEquals(self.feed.feed_link[2].rel, + self.assertEqual(self.feed.feed_link[2].rel, 'http://gdata.youtube.com/schemas/2007#user.inbox') - self.assertEquals(self.feed.feed_link[3].count_hint, None) - self.assertEquals(self.feed.feed_link[3].href, + self.assertEqual(self.feed.feed_link[3].count_hint, None) + self.assertEqual(self.feed.feed_link[3].href, 'http://gdata.youtube.com/feeds/users/andyland74/playlists') - self.assertEquals(self.feed.feed_link[3].rel, + self.assertEqual(self.feed.feed_link[3].rel, 'http://gdata.youtube.com/schemas/2007#user.playlists') - self.assertEquals(self.feed.feed_link[4].count_hint, '4') - self.assertEquals(self.feed.feed_link[4].href, + self.assertEqual(self.feed.feed_link[4].count_hint, '4') + self.assertEqual(self.feed.feed_link[4].href, 'http://gdata.youtube.com/feeds/users/andyland74/subscriptions') - self.assertEquals(self.feed.feed_link[4].rel, + self.assertEqual(self.feed.feed_link[4].rel, 'http://gdata.youtube.com/schemas/2007#user.subscriptions') - self.assertEquals(self.feed.feed_link[5].count_hint, '1') - self.assertEquals(self.feed.feed_link[5].href, + self.assertEqual(self.feed.feed_link[5].count_hint, '1') + self.assertEqual(self.feed.feed_link[5].href, 'http://gdata.youtube.com/feeds/users/andyland74/uploads') - self.assertEquals(self.feed.feed_link[5].rel, + self.assertEqual(self.feed.feed_link[5].rel, 'http://gdata.youtube.com/schemas/2007#user.uploads') - self.assertEquals(self.feed.first_name.text, 'andy') - self.assertEquals(self.feed.last_name.text, 'example') - self.assertEquals(self.feed.link[0].href, + self.assertEqual(self.feed.first_name.text, 'andy') + self.assertEqual(self.feed.last_name.text, 'example') + self.assertEqual(self.feed.link[0].href, 'http://www.youtube.com/profile?user=andyland74') - self.assertEquals(self.feed.link[0].rel, 'alternate') - self.assertEquals(self.feed.link[1].href, + self.assertEqual(self.feed.link[0].rel, 'alternate') + self.assertEqual(self.feed.link[1].href, 'http://gdata.youtube.com/feeds/users/andyland74') - self.assertEquals(self.feed.link[1].rel, 'self') - self.assertEquals(self.feed.location.text, 'US') - self.assertEquals(self.feed.movies.text, 'Aqua Teen Hungerforce') - self.assertEquals(self.feed.music.text, 'Elliott Smith') - self.assertEquals(self.feed.occupation.text, 'Technical Writer') - self.assertEquals(self.feed.published.text, '2006-10-16T00:09:45.000-07:00') - self.assertEquals(self.feed.school.text, 'University of North Carolina') - self.assertEquals(self.feed.statistics.last_web_access, +RefactoringTool: Refactored ./tests/gdata_tests/youtube/service_test.py self.assertEqual(self.feed.link[1].rel, 'self') + self.assertEqual(self.feed.location.text, 'US') + self.assertEqual(self.feed.movies.text, 'Aqua Teen Hungerforce') + self.assertEqual(self.feed.music.text, 'Elliott Smith') + self.assertEqual(self.feed.occupation.text, 'Technical Writer') + self.assertEqual(self.feed.published.text, '2006-10-16T00:09:45.000-07:00') + self.assertEqual(self.feed.school.text, 'University of North Carolina') + self.assertEqual(self.feed.statistics.last_web_access, '2008-02-25T16:03:38.000-08:00') - self.assertEquals(self.feed.statistics.subscriber_count, '1') - self.assertEquals(self.feed.statistics.video_watch_count, '21') - self.assertEquals(self.feed.statistics.view_count, '9') - self.assertEquals(self.feed.thumbnail.url, + self.assertEqual(self.feed.statistics.subscriber_count, '1') + self.assertEqual(self.feed.statistics.video_watch_count, '21') + self.assertEqual(self.feed.statistics.view_count, '9') + self.assertEqual(self.feed.thumbnail.url, 'http://i.ytimg.com/vi/YFbSxcdOL-w/default.jpg') - self.assertEquals(self.feed.title.text, 'andyland74 Channel') - self.assertEquals(self.feed.updated.text, '2008-02-26T11:48:21.000-08:00') - self.assertEquals(self.feed.username.text, 'andyland74') + self.assertEqual(self.feed.title.text, 'andyland74 Channel') + self.assertEqual(self.feed.updated.text, '2008-02-26T11:48:21.000-08:00') + self.assertEqual(self.feed.username.text, 'andyland74') if __name__ == '__main__': unittest.main() --- ./tests/gdata_tests/youtube/service_test.py (original) +++ ./tests/gdata_tests/youtube/service_test.py (refactored) @@ -18,7 +18,7 @@ import getpass import time -import StringIO +import io import random import unittest import atom @@ -42,92 +42,92 @@ def testRetrieveVideoFeed(self): feed = self.client.GetYouTubeVideoFeed( 'https://gdata.youtube.com/feeds/api/standardfeeds/recently_featured'); - self.assert_(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) - self.assert_(len(feed.entry) > 0) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) + self.assertTrue(len(feed.entry) > 0) for entry in feed.entry: - self.assert_(entry.title.text != '') + self.assertTrue(entry.title.text != '') def testRetrieveTopRatedVideoFeed(self): feed = self.client.GetTopRatedVideoFeed() - self.assert_(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) - self.assert_(len(feed.entry) > 10) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) + self.assertTrue(len(feed.entry) > 10) def testRetrieveMostViewedVideoFeed(self): feed = self.client.GetMostViewedVideoFeed() - self.assert_(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) - self.assert_(len(feed.entry) > 10) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) + self.assertTrue(len(feed.entry) > 10) def testRetrieveRecentlyFeaturedVideoFeed(self): feed = self.client.GetRecentlyFeaturedVideoFeed() - self.assert_(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) - self.assert_(len(feed.entry) > 10) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) + self.assertTrue(len(feed.entry) > 10) def testRetrieveWatchOnMobileVideoFeed(self): feed = self.client.GetWatchOnMobileVideoFeed() - self.assert_(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) - self.assert_(len(feed.entry) > 10) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) + self.assertTrue(len(feed.entry) > 10) def testRetrieveTopFavoritesVideoFeed(self): feed = self.client.GetTopFavoritesVideoFeed() - self.assert_(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) - self.assert_(len(feed.entry) > 10) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) + self.assertTrue(len(feed.entry) > 10) def testRetrieveMostRecentVideoFeed(self): feed = self.client.GetMostRecentVideoFeed() - self.assert_(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) - self.assert_(len(feed.entry) > 10) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) + self.assertTrue(len(feed.entry) > 10) def testRetrieveMostDiscussedVideoFeed(self): feed = self.client.GetMostDiscussedVideoFeed() - self.assert_(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) - self.assert_(len(feed.entry) > 10) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) + self.assertTrue(len(feed.entry) > 10) def testRetrieveMostLinkedVideoFeed(self): feed = self.client.GetMostLinkedVideoFeed() - self.assert_(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) - self.assert_(len(feed.entry) > 10) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) + self.assertTrue(len(feed.entry) > 10) def testRetrieveMostRespondedVideoFeed(self): feed = self.client.GetMostRespondedVideoFeed() - self.assert_(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) - self.assert_(len(feed.entry) > 10) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) + self.assertTrue(len(feed.entry) > 10) def testRetrieveVideoEntryByUri(self): entry = self.client.GetYouTubeVideoEntry( 'https://gdata.youtube.com/feeds/videos/Ncakifd_16k') - self.assert_(isinstance(entry, gdata.youtube.YouTubeVideoEntry)) - self.assert_(entry.title.text != '') + self.assertTrue(isinstance(entry, gdata.youtube.YouTubeVideoEntry)) + self.assertTrue(entry.title.text != '') def testRetrieveVideoEntryByVideoId(self): entry = self.client.GetYouTubeVideoEntry(video_id='Ncakifd_16k') - self.assert_(isinstance(entry, gdata.youtube.YouTubeVideoEntry)) - self.assert_(entry.title.text != '') + self.assertTrue(isinstance(entry, gdata.youtube.YouTubeVideoEntry)) + self.assertTrue(entry.title.text != '') def testRetrieveUserVideosbyUri(self): feed = self.client.GetYouTubeUserFeed( 'https://gdata.youtube.com/feeds/users/gdpython/uploads') - self.assert_(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) - self.assert_(len(feed.entry) > 0) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) + self.assertTrue(len(feed.entry) > 0) def testRetrieveUserVideosbyUsername(self): feed = self.client.GetYouTubeUserFeed(username='gdpython') - self.assert_(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) - self.assert_(len(feed.entry) > 0) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) + self.assertTrue(len(feed.entry) > 0) def testSearchWithVideoQuery(self): query = gdata.youtube.service.YouTubeVideoQuery() query.vq = 'google' query.max_results = 8 feed = self.client.YouTubeQuery(query) - self.assert_(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) - self.assertEquals(len(feed.entry), 8) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) + self.assertEqual(len(feed.entry), 8) def testDirectVideoUploadStatusUpdateAndDeletion(self): - self.assertEquals(self.client.developer_key, developer_key) - self.assertEquals(self.client.client_id, YOUTUBE_TEST_CLIENT_ID) - self.assertEquals(self.client.additional_headers['X-GData-Key'], + self.assertEqual(self.client.developer_key, developer_key) + self.assertEqual(self.client.client_id, YOUTUBE_TEST_CLIENT_ID) + self.assertEqual(self.client.additional_headers['X-GData-Key'], 'key=' + developer_key) - self.assertEquals(self.client.additional_headers['X-Gdata-Client'], + self.assertEqual(self.client.additional_headers['X-Gdata-Client'], YOUTUBE_TEST_CLIENT_ID) test_video_title = 'my cool video ' + str(random.randint(1000,5000)) @@ -144,7 +144,7 @@ label='Autos'), player=None ) - self.assert_(isinstance(my_media_group, gdata.media.Group)) + self.assertTrue(isinstance(my_media_group, gdata.media.Group)) # Set Geo location to 37,-122 lat, long where = gdata.geo.Where() @@ -153,17 +153,17 @@ video_entry = gdata.youtube.YouTubeVideoEntry(media=my_media_group, geo=where) - self.assert_(isinstance(video_entry, gdata.youtube.YouTubeVideoEntry)) + self.assertTrue(isinstance(video_entry, gdata.youtube.YouTubeVideoEntry)) new_entry = self.client.InsertVideoEntry(video_entry, video_file_location) - self.assert_(isinstance(new_entry, gdata.youtube.YouTubeVideoEntry)) - self.assertEquals(new_entry.title.text, test_video_title) - self.assertEquals(new_entry.media.description.text, test_video_description) - self.assert_(new_entry.id.text) + self.assertTrue(isinstance(new_entry, gdata.youtube.YouTubeVideoEntry)) + self.assertEqual(new_entry.title.text, test_video_title) + self.assertEqual(new_entry.media.description.text, test_video_description) + self.assertTrue(new_entry.id.text) # check upload status also upload_status = self.client.CheckUploadStatus(new_entry) - self.assert_(upload_status[0] != '') + self.assertTrue(upload_status[0] != '') # test updating entry meta-data new_video_description = 'description ' + str(random.randint(1000,5000)) @@ -171,8 +171,8 @@ updated_entry = self.client.UpdateVideoEntry(new_entry) - self.assert_(isinstance(updated_entry, gdata.youtube.YouTubeVideoEntry)) - self.assertEquals(updated_entry.media.description.text, + self.assertTrue(isinstance(updated_entry, gdata.youtube.YouTubeVideoEntry)) + self.assertEqual(updated_entry.media.description.text, new_video_description) # sleep for 10 seconds @@ -187,14 +187,14 @@ # test to delete the entry value = self.client.DeleteVideoEntry(updated_entry) - self.assert_(value == True) + self.assertTrue(value == True) def testDirectVideoUploadWithDeveloperTags(self): - self.assertEquals(self.client.developer_key, developer_key) - self.assertEquals(self.client.client_id, YOUTUBE_TEST_CLIENT_ID) - self.assertEquals(self.client.additional_headers['X-GData-Key'], + self.assertEqual(self.client.developer_key, developer_key) + self.assertEqual(self.client.client_id, YOUTUBE_TEST_CLIENT_ID) + self.assertEqual(self.client.additional_headers['X-GData-Key'], 'key=' + developer_key) - self.assertEquals(self.client.additional_headers['X-Gdata-Client'], + self.assertEqual(self.client.additional_headers['X-Gdata-Client'], YOUTUBE_TEST_CLIENT_ID) test_video_title = 'my cool video ' + str(random.randint(1000,5000)) @@ -216,7 +216,7 @@ player=None ) - self.assert_(isinstance(my_media_group, gdata.media.Group)) + self.assertTrue(isinstance(my_media_group, gdata.media.Group)) video_entry = gdata.youtube.YouTubeVideoEntry(media=my_media_group) original_developer_tags = [test_developer_tag_01, test_developer_tag_02, @@ -225,22 +225,22 @@ dev_tags = video_entry.AddDeveloperTags(original_developer_tags) for dev_tag in dev_tags: - self.assert_(dev_tag.text in original_developer_tags) - - self.assert_(isinstance(video_entry, gdata.youtube.YouTubeVideoEntry)) + self.assertTrue(dev_tag.text in original_developer_tags) + + self.assertTrue(isinstance(video_entry, gdata.youtube.YouTubeVideoEntry)) new_entry = self.client.InsertVideoEntry(video_entry, video_file_location) - self.assert_(isinstance(new_entry, gdata.youtube.YouTubeVideoEntry)) - self.assertEquals(new_entry.title.text, test_video_title) - self.assertEquals(new_entry.media.description.text, test_video_description) - self.assert_(new_entry.id.text) + self.assertTrue(isinstance(new_entry, gdata.youtube.YouTubeVideoEntry)) + self.assertEqual(new_entry.title.text, test_video_title) + self.assertEqual(new_entry.media.description.text, test_video_description) + self.assertTrue(new_entry.id.text) developer_tags_from_new_entry = new_entry.GetDeveloperTags() for dev_tag in developer_tags_from_new_entry: - self.assert_(dev_tag.text in original_developer_tags) - - self.assertEquals(len(developer_tags_from_new_entry), + self.assertTrue(dev_tag.text in original_developer_tags) + + self.assertEqual(len(developer_tags_from_new_entry), len(original_developer_tags)) # sleep for 10 seconds @@ -255,14 +255,14 @@ # test to delete the entry value = self.client.DeleteVideoEntry(new_entry) - self.assert_(value == True) + self.assertTrue(value == True) def testBrowserBasedVideoUpload(self): - self.assertEquals(self.client.developer_key, developer_key) - self.assertEquals(self.client.client_id, YOUTUBE_TEST_CLIENT_ID) - self.assertEquals(self.client.additional_headers['X-GData-Key'], + self.assertEqual(self.client.developer_key, developer_key) + self.assertEqual(self.client.client_id, YOUTUBE_TEST_CLIENT_ID) + self.assertEqual(self.client.additional_headers['X-GData-Key'], 'key=' + developer_key) - self.assertEquals(self.client.additional_headers['X-Gdata-Client'], + self.assertEqual(self.client.additional_headers['X-Gdata-Client'], YOUTUBE_TEST_CLIENT_ID) test_video_title = 'my cool video ' + str(random.randint(1000,5000)) test_video_description = 'description ' + str(random.randint(1000,5000)) @@ -278,49 +278,49 @@ label='Autos'), player=None ) - self.assert_(isinstance(my_media_group, gdata.media.Group)) + self.assertTrue(isinstance(my_media_group, gdata.media.Group)) video_entry = gdata.youtube.YouTubeVideoEntry(media=my_media_group) - self.assert_(isinstance(video_entry, gdata.youtube.YouTubeVideoEntry)) + self.assertTrue(isinstance(video_entry, gdata.youtube.YouTubeVideoEntry)) response = self.client.GetFormUploadToken(video_entry) - self.assert_(response[0].startswith( + self.assertTrue(response[0].startswith( 'https://uploads.gdata.youtube.com/action/FormDataUpload/')) - self.assert_(len(response[0]) > 55) - self.assert_(len(response[1]) > 100) + self.assertTrue(len(response[0]) > 55) + self.assertTrue(len(response[1]) > 100) def testRetrieveRelatedVideoFeedByUri(self): feed = self.client.GetYouTubeRelatedVideoFeed( 'https://gdata.youtube.com/feeds/videos/Ncakifd_16k/related') - self.assert_(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) - self.assert_(len(feed.entry) > 0) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) + self.assertTrue(len(feed.entry) > 0) def testRetrieveRelatedVideoFeedById(self): feed = self.client.GetYouTubeRelatedVideoFeed(video_id = 'Ncakifd_16k') - self.assert_(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) - self.assert_(len(feed.entry) > 0) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) + self.assertTrue(len(feed.entry) > 0) def testRetrieveResponseVideoFeedByUri(self): feed = self.client.GetYouTubeVideoResponseFeed( 'https://gdata.youtube.com/feeds/videos/Ncakifd_16k/responses') - self.assert_(isinstance(feed, gdata.youtube.YouTubeVideoResponseFeed)) - self.assert_(len(feed.entry) > 0) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeVideoResponseFeed)) + self.assertTrue(len(feed.entry) > 0) def testRetrieveResponseVideoFeedById(self): feed = self.client.GetYouTubeVideoResponseFeed(video_id='Ncakifd_16k') - self.assert_(isinstance(feed, gdata.youtube.YouTubeVideoResponseFeed)) - self.assert_(len(feed.entry) > 0) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeVideoResponseFeed)) + self.assertTrue(len(feed.entry) > 0) def testRetrieveVideoCommentFeedByUri(self): feed = self.client.GetYouTubeVideoCommentFeed( 'https://gdata.youtube.com/feeds/api/videos/Ncakifd_16k/comments') - self.assert_(isinstance(feed, gdata.youtube.YouTubeVideoCommentFeed)) - self.assert_(len(feed.entry) > 0) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeVideoCommentFeed)) + self.assertTrue(len(feed.entry) > 0) def testRetrieveVideoCommentFeedByVideoId(self): feed = self.client.GetYouTubeVideoCommentFeed(video_id='Ncakifd_16k') - self.assert_(isinstance(feed, gdata.youtube.YouTubeVideoCommentFeed)) - self.assert_(len(feed.entry) > 0) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeVideoCommentFeed)) + self.assertTrue(len(feed.entry) > 0) def testAddComment(self): video_id = '9g6buYJTt_g' @@ -333,31 +333,31 @@ for item in comment_feed.entry: if (item.content.text == random_comment_text): comment_found = True - self.assertEquals(comment_found, True) + self.assertEqual(comment_found, True) def testAddRating(self): video_id_to_rate = 'Ncakifd_16k' video_entry = self.client.GetYouTubeVideoEntry(video_id=video_id_to_rate) response = self.client.AddRating(3, video_entry) - self.assert_(isinstance(response, gdata.GDataEntry)) + self.assertTrue(isinstance(response, gdata.GDataEntry)) def testRetrievePlaylistFeedByUri(self): feed = self.client.GetYouTubePlaylistFeed( 'https://gdata.youtube.com/feeds/users/gdpython/playlists') - self.assert_(isinstance(feed, gdata.youtube.YouTubePlaylistFeed)) - self.assert_(len(feed.entry) > 0) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubePlaylistFeed)) + self.assertTrue(len(feed.entry) > 0) def testRetrievePlaylistListFeedByUsername(self): feed = self.client.GetYouTubePlaylistFeed(username='gdpython') - self.assert_(isinstance(feed, gdata.youtube.YouTubePlaylistFeed)) - self.assert_(len(feed.entry) > 0) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubePlaylistFeed)) + self.assertTrue(len(feed.entry) > 0) def testRetrievePlaylistVideoFeed(self): feed = self.client.GetYouTubePlaylistVideoFeed( 'https://gdata.youtube.com/feeds/api/playlists/BCB3BB96DF51B505') - self.assert_(isinstance(feed, gdata.youtube.YouTubePlaylistVideoFeed)) - self.assert_(len(feed.entry) > 0) - self.assert_(isinstance(feed.entry[0], + self.assertTrue(isinstance(feed, gdata.youtube.YouTubePlaylistVideoFeed)) + self.assertTrue(len(feed.entry) > 0) + self.assertTrue(isinstance(feed.entry[0], gdata.youtube.YouTubePlaylistVideoEntry)) def testAddUpdateAndDeletePlaylist(self): @@ -365,7 +365,7 @@ test_playlist_description = 'test playlist ' response = self.client.AddPlaylist(test_playlist_title, test_playlist_description) - self.assert_(isinstance(response, gdata.youtube.YouTubePlaylistEntry)) + self.assertTrue(isinstance(response, gdata.youtube.YouTubePlaylistEntry)) new_playlist_title = 'my updated playlist ' + str(random.randint(1000,4000)) new_playlist_description = 'my updated playlist ' @@ -384,14 +384,14 @@ update_successful = True break - self.assertEquals(update_successful, True) + self.assertEqual(update_successful, True) # wait time.sleep(10) # delete it playlist_uri = updated_playlist.id.text response = self.client.DeletePlaylist(playlist_uri) - self.assertEquals(response, True) + self.assertEqual(response, True) def testAddUpdateAndDeletePrivatePlaylist(self): test_playlist_title = 'my test playlist ' + str(random.randint(1000,3000)) @@ -399,7 +399,7 @@ response = self.client.AddPlaylist(test_playlist_title, test_playlist_description, playlist_private=True) - self.assert_(isinstance(response, gdata.youtube.YouTubePlaylistEntry)) + self.assertTrue(isinstance(response, gdata.youtube.YouTubePlaylistEntry)) new_playlist_title = 'my updated playlist ' + str(random.randint(1000,4000)) new_playlist_description = 'my updated playlist ' @@ -420,22 +420,22 @@ if playlist_entry.private is not None: playlist_still_private = True - self.assertEquals(update_successful, True) - self.assertEquals(playlist_still_private, True) + self.assertEqual(update_successful, True) + self.assertEqual(playlist_still_private, True) # wait time.sleep(10) # delete it playlist_uri = updated_playlist.id.text response = self.client.DeletePlaylist(playlist_uri) - self.assertEquals(response, True) + self.assertEqual(response, True) def testAddEditAndDeleteVideoFromPlaylist(self): test_playlist_title = 'my test playlist ' + str(random.randint(1000,3000)) test_playlist_description = 'test playlist ' response = self.client.AddPlaylist(test_playlist_title, test_playlist_description) - self.assert_(isinstance(response, gdata.youtube.YouTubePlaylistEntry)) + self.assertTrue(isinstance(response, gdata.youtube.YouTubePlaylistEntry)) custom_video_title = 'my test video on my test playlist' custom_video_description = 'this is a test video on my test playlist' @@ -445,7 +445,7 @@ response = self.client.AddPlaylistVideoEntryToPlaylist( playlist_uri, video_id, custom_video_title, custom_video_description) - self.assert_(isinstance(response, gdata.youtube.YouTubePlaylistVideoEntry)) + self.assertTrue(isinstance(response, gdata.youtube.YouTubePlaylistVideoEntry)) playlist_entry_id = response.id.text.split('/')[-1] playlist_uri = response.id.text.split(playlist_entry_id)[0][:-1] @@ -458,25 +458,25 @@ new_video_title, new_video_description, 1) - self.assert_(isinstance(response, gdata.youtube.YouTubePlaylistVideoEntry)) + self.assertTrue(isinstance(response, gdata.youtube.YouTubePlaylistVideoEntry)) time.sleep(10) playlist_entry_id = response.id.text.split('/')[-1] # remove video from playlist response = self.client.DeletePlaylistVideoEntry(playlist_uri, playlist_entry_id) - self.assertEquals(response, True) + self.assertEqual(response, True) time.sleep(10) # delete the playlist response = self.client.DeletePlaylist(playlist_uri) - self.assertEquals(response, True) + self.assertEqual(response, True) def testRetrieveSubscriptionFeedByUri(self): feed = self.client.GetYouTubeSubscriptionFeed( 'https://gdata.youtube.com/feeds/users/gdpython/subscriptions') - self.assert_(isinstance(feed, gdata.youtube.YouTubeSubscriptionFeed)) - self.assert_(len(feed.entry) == 3) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeSubscriptionFeed)) + self.assertTrue(len(feed.entry) == 3) subscription_to_channel_found = False subscription_to_favorites_found = False @@ -484,7 +484,7 @@ all_types_found = False for entry in feed.entry: - self.assert_(isinstance(entry, gdata.youtube.YouTubeSubscriptionEntry)) + self.assertTrue(isinstance(entry, gdata.youtube.YouTubeSubscriptionEntry)) subscription_type = entry.GetSubscriptionType() if subscription_type == 'channel': subscription_to_channel_found = True @@ -497,12 +497,12 @@ subscription_to_query_found): all_types_found = True - self.assertEquals(all_types_found, True) + self.assertEqual(all_types_found, True) def testRetrieveSubscriptionFeedByUsername(self): feed = self.client.GetYouTubeSubscriptionFeed(username='gdpython') - self.assert_(isinstance(feed, gdata.youtube.YouTubeSubscriptionFeed)) - self.assert_(len(feed.entry) == 3) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeSubscriptionFeed)) + self.assertTrue(len(feed.entry) == 3) subscription_to_channel_found = False subscription_to_favorites_found = False @@ -510,7 +510,7 @@ all_types_found = False for entry in feed.entry: - self.assert_(isinstance(entry, gdata.youtube.YouTubeSubscriptionEntry)) + self.assertTrue(isinstance(entry, gdata.youtube.YouTubeSubscriptionEntry)) subscription_type = entry.GetSubscriptionType() if subscription_type == 'channel': subscription_to_channel_found = True @@ -522,55 +522,55 @@ if (subscription_to_channel_found and subscription_to_favorites_found and subscription_to_query_found): all_types_found = True - self.assertEquals(all_types_found, True) RefactoringTool: Refactored ./tests/gdata_tests/youtube/live_client_test.py RefactoringTool: Refactored ./tests/gdata_tests/webmastertools_test.py + self.assertEqual(all_types_found, True) def testRetrieveUserProfileByUri(self): user = self.client.GetYouTubeUserEntry( 'https://gdata.youtube.com/feeds/users/gdpython') - self.assert_(isinstance(user, gdata.youtube.YouTubeUserEntry)) - self.assertEquals(user.location.text, 'US') + self.assertTrue(isinstance(user, gdata.youtube.YouTubeUserEntry)) + self.assertEqual(user.location.text, 'US') def testRetrieveUserProfileByUsername(self): user = self.client.GetYouTubeUserEntry(username='gdpython') - self.assert_(isinstance(user, gdata.youtube.YouTubeUserEntry)) - self.assertEquals(user.location.text, 'US') + self.assertTrue(isinstance(user, gdata.youtube.YouTubeUserEntry)) + self.assertEqual(user.location.text, 'US') def testRetrieveUserFavoritesFeed(self): feed = self.client.GetUserFavoritesFeed(username='gdpython') - self.assert_(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) - self.assert_(len(feed.entry) > 0) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) + self.assertTrue(len(feed.entry) > 0) def testRetrieveDefaultUserFavoritesFeed(self): feed = self.client.GetUserFavoritesFeed() - self.assert_(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) - self.assert_(len(feed.entry) > 0) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeVideoFeed)) + self.assertTrue(len(feed.entry) > 0) def testAddAndDeleteVideoFromFavorites(self): video_id = 'Ncakifd_16k' video_entry = self.client.GetYouTubeVideoEntry(video_id=video_id) response = self.client.AddVideoEntryToFavorites(video_entry) - self.assert_(isinstance(response, gdata.GDataEntry)) + self.assertTrue(isinstance(response, gdata.GDataEntry)) time.sleep(10) response = self.client.DeleteVideoEntryFromFavorites(video_id) - self.assertEquals(response, True) + self.assertEqual(response, True) def testRetrieveContactFeedByUri(self): feed = self.client.GetYouTubeContactFeed( 'https://gdata.youtube.com/feeds/users/gdpython/contacts') - self.assert_(isinstance(feed, gdata.youtube.YouTubeContactFeed)) - self.assertEquals(len(feed.entry), 1) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeContactFeed)) + self.assertEqual(len(feed.entry), 1) def testRetrieveContactFeedByUsername(self): feed = self.client.GetYouTubeContactFeed(username='gdpython') - self.assert_(isinstance(feed, gdata.youtube.YouTubeContactFeed)) - self.assertEquals(len(feed.entry), 1) + self.assertTrue(isinstance(feed, gdata.youtube.YouTubeContactFeed)) + self.assertEqual(len(feed.entry), 1) if __name__ == '__main__': print ('NOTE: Please run these tests only with a test account. ' 'The tests may delete or update your data.') - username = raw_input('Please enter your username: ') + username = input('Please enter your username: ') password = getpass.getpass() - developer_key = raw_input('Please enter your developer key: ') - video_file_location = raw_input( + developer_key = input('Please enter your developer key: ') + video_file_location = input( 'Please enter the absolute path to a video file: ') unittest.main() --- ./tests/gdata_tests/youtube/live_client_test.py (original) +++ ./tests/gdata_tests/youtube/live_client_test.py (refactored) @@ -22,8 +22,8 @@ # Python imports. import unittest -import urllib -import urllib2 +import urllib.request, urllib.parse, urllib.error +import urllib.request, urllib.error, urllib.parse # Google Data APIs imports. import gdata.youtube.client --- ./tests/gdata_tests/webmastertools_test.py (original) +++ ./tests/gdata_tests/webmastertools_test.py (refactored) @@ -35,9 +35,9 @@ def testToAndFromString(self): self.indexed.text = 'true' - self.assert_(self.indexed.text == 'true') + self.assertTrue(self.indexed.text == 'true') new_indexed = webmastertools.IndexedFromString(self.indexed.ToString()) - self.assert_(self.indexed.text == new_indexed.text) + self.assertTrue(self.indexed.text == new_indexed.text) class CrawledTest(unittest.TestCase): @@ -47,9 +47,9 @@ def testToAndFromString(self): self.crawled.text = 'true' - self.assert_(self.crawled.text == 'true') + self.assertTrue(self.crawled.text == 'true') new_crawled = webmastertools.CrawledFromString(self.crawled.ToString()) - self.assert_(self.crawled.text == new_crawled.text) + self.assertTrue(self.crawled.text == new_crawled.text) class GeoLocationTest(unittest.TestCase): @@ -59,10 +59,10 @@ def testToAndFromString(self): self.geolocation.text = 'US' - self.assert_(self.geolocation.text == 'US') + self.assertTrue(self.geolocation.text == 'US') new_geolocation = webmastertools.GeoLocationFromString( self.geolocation.ToString()) - self.assert_(self.geolocation.text == new_geolocation.text) + self.assertTrue(self.geolocation.text == new_geolocation.text) class PreferredDomainTest(unittest.TestCase): @@ -72,10 +72,10 @@ def testToAndFromString(self): self.preferred_domain.text = 'none' - self.assert_(self.preferred_domain.text == 'none') + self.assertTrue(self.preferred_domain.text == 'none') new_preferred_domain = webmastertools.PreferredDomainFromString( self.preferred_domain.ToString()) - self.assert_(self.preferred_domain.text == new_preferred_domain.text) + self.assertTrue(self.preferred_domain.text == new_preferred_domain.text) class CrawlRateTest(unittest.TestCase): @@ -85,10 +85,10 @@ def testToAndFromString(self): self.crawl_rate.text = 'normal' - self.assert_(self.crawl_rate.text == 'normal') + self.assertTrue(self.crawl_rate.text == 'normal') new_crawl_rate = webmastertools.CrawlRateFromString( self.crawl_rate.ToString()) - self.assert_(self.crawl_rate.text == new_crawl_rate.text) + self.assertTrue(self.crawl_rate.text == new_crawl_rate.text) class EnhancedImageSearchTest(unittest.TestCase): @@ -98,10 +98,10 @@ def testToAndFromString(self): self.enhanced_image_search.text = 'true' - self.assert_(self.enhanced_image_search.text == 'true') + self.assertTrue(self.enhanced_image_search.text == 'true') new_enhanced_image_search = webmastertools.EnhancedImageSearchFromString( self.enhanced_image_search.ToString()) - self.assert_(self.enhanced_image_search.text == + self.assertTrue(self.enhanced_image_search.text == new_enhanced_image_search.text) @@ -112,9 +112,9 @@ def testToAndFromString(self): self.verified.text = 'true' - self.assert_(self.verified.text == 'true') + self.assertTrue(self.verified.text == 'true') new_verified = webmastertools.VerifiedFromString(self.verified.ToString()) - self.assert_(self.verified.text == new_verified.text) + self.assertTrue(self.verified.text == new_verified.text) class VerificationMethodMetaTest(unittest.TestCase): @@ -125,12 +125,12 @@ def testToAndFromString(self): self.meta.name = 'verify-vf1' self.meta.content = 'a2Ai' - self.assert_(self.meta.name == 'verify-vf1') - self.assert_(self.meta.content == 'a2Ai') + self.assertTrue(self.meta.name == 'verify-vf1') + self.assertTrue(self.meta.content == 'a2Ai') new_meta = webmastertools.VerificationMethodMetaFromString( self.meta.ToString()) - self.assert_(self.meta.name == new_meta.name) - self.assert_(self.meta.content == new_meta.content) + self.assertTrue(self.meta.name == new_meta.name) + self.assertTrue(self.meta.content == new_meta.content) class VerificationMethodTest(unittest.TestCase): @@ -142,59 +142,59 @@ self.method = webmastertools.VerificationMethod() self.method.type = 'metatag' self.method.in_use = 'false' - self.assert_(self.method.type == 'metatag') - self.assert_(self.method.in_use == 'false') + self.assertTrue(self.method.type == 'metatag') + self.assertTrue(self.method.in_use == 'false') self.method.meta = webmastertools.VerificationMethodMeta(name='verify-vf1', content='a2Ai') - self.assert_(self.method.meta.name == 'verify-vf1') - self.assert_(self.method.meta.content == 'a2Ai') + self.assertTrue(self.method.meta.name == 'verify-vf1') + self.assertTrue(self.method.meta.content == 'a2Ai') new_method = webmastertools.VerificationMethodFromString( self.method.ToString()) - self.assert_(self.method.type == new_method.type) - self.assert_(self.method.in_use == new_method.in_use) - self.assert_(self.method.meta.name == new_method.meta.name) - self.assert_(self.method.meta.content == new_method.meta.content) + self.assertTrue(self.method.type == new_method.type) + self.assertTrue(self.method.in_use == new_method.in_use) + self.assertTrue(self.method.meta.name == new_method.meta.name) + self.assertTrue(self.method.meta.content == new_method.meta.content) method = webmastertools.VerificationMethod(type='xyz') self.assertEqual(method.type, 'xyz') method = webmastertools.VerificationMethod() - self.assert_(method.type is None) + self.assertTrue(method.type is None) def testHtmlPageToAndFromString(self): self.method = webmastertools.VerificationMethod() self.method.type = 'htmlpage' self.method.in_use = 'false' self.method.text = '456456-google.html' - self.assert_(self.method.type == 'htmlpage') - self.assert_(self.method.in_use == 'false') - self.assert_(self.method.text == '456456-google.html') - self.assert_(self.method.meta is None) + self.assertTrue(self.method.type == 'htmlpage') + self.assertTrue(self.method.in_use == 'false') + self.assertTrue(self.method.text == '456456-google.html') + self.assertTrue(self.method.meta is None) new_method = webmastertools.VerificationMethodFromString( self.method.ToString()) - self.assert_(self.method.type == new_method.type) - self.assert_(self.method.in_use == new_method.in_use) - self.assert_(self.method.text == new_method.text) - self.assert_(self.method.meta is None) + self.assertTrue(self.method.type == new_method.type) + self.assertTrue(self.method.in_use == new_method.in_use) + self.assertTrue(self.method.text == new_method.text) + self.assertTrue(self.method.meta is None) def testConvertActualData(self): feed = webmastertools.SitesFeedFromString(test_data.SITES_FEED) - self.assert_(len(feed.entry[0].verification_method) == 2) + self.assertTrue(len(feed.entry[0].verification_method) == 2) check = 0 for method in feed.entry[0].verification_method: - self.assert_(isinstance(method, webmastertools.VerificationMethod)) + self.assertTrue(isinstance(method, webmastertools.VerificationMethod)) if method.type == 'metatag': - self.assert_(method.in_use == 'false') - self.assert_(method.text is None) - self.assert_(method.meta.name == 'verify-v1') - self.assert_(method.meta.content == 'a2Ai') + self.assertTrue(method.in_use == 'false') + self.assertTrue(method.text is None) + self.assertTrue(method.meta.name == 'verify-v1') + self.assertTrue(method.meta.content == 'a2Ai') check = check | 1 elif method.type == 'htmlpage': - self.assert_(method.in_use == 'false') - self.assert_(method.text == '456456-google.html') + self.assertTrue(method.in_use == 'false') + self.assertTrue(method.text == '456456-google.html') check = check | 2 else: self.fail('Wrong Verification Method: %s' % method.type) - self.assert_(check == 2 ** 2 - 1, + self.assertTrue(check == 2 ** 2 - 1, 'Should only have two Verification Methods, metatag and htmlpage') @@ -205,10 +205,10 @@ def testToAndFromString(self): self.markup_language.text = 'HTML' - self.assert_(self.markup_language.text == 'HTML') + self.assertTrue(self.markup_language.text == 'HTML') new_markup_language = webmastertools.MarkupLanguageFromString( self.markup_language.ToString()) - self.assert_(self.markup_language.text == new_markup_language.text) + self.assertTrue(self.markup_language.text == new_markup_language.text) class SitemapMobileTest(unittest.TestCase): @@ -219,28 +219,28 @@ def testToAndFromString(self): self.sitemap_mobile.markup_language.append(webmastertools.MarkupLanguage( text = 'HTML')) - self.assert_(self.sitemap_mobile.text is None) - self.assert_(self.sitemap_mobile.markup_language[0].text == 'HTML') + self.assertTrue(self.sitemap_mobile.text is None) + self.assertTrue(self.sitemap_mobile.markup_language[0].text == 'HTML') new_sitemap_mobile = webmastertools.SitemapMobileFromString( self.sitemap_mobile.ToString()) - self.assert_(new_sitemap_mobile.text is None) - self.assert_(self.sitemap_mobile.markup_language[0].text == + self.assertTrue(new_sitemap_mobile.text is None) + self.assertTrue(self.sitemap_mobile.markup_language[0].text == new_sitemap_mobile.markup_language[0].text) def testConvertActualData(self): feed = webmastertools.SitemapsFeedFromString(test_data.SITEMAPS_FEED) - self.assert_(feed.sitemap_mobile.text.strip() == '') - self.assert_(len(feed.sitemap_mobile.markup_language) == 2) + self.assertTrue(feed.sitemap_mobile.text.strip() == '') + self.assertTrue(len(feed.sitemap_mobile.markup_language) == 2) check = 0 for markup_language in feed.sitemap_mobile.markup_language: - self.assert_(isinstance(markup_language, webmastertools.MarkupLanguage)) + self.assertTrue(isinstance(markup_language, webmastertools.MarkupLanguage)) if markup_language.text == "HTML": check = check | 1 elif markup_language.text == "WAP": check = check | 2 else: self.fail('Unexpected markup language: %s' % markup_language.text) - self.assert_(check == 2 ** 2 - 1, "Something is wrong with markup language") + self.assertTrue(check == 2 ** 2 - 1, "Something is wrong with markup language") class SitemapMobileMarkupLanguageTest(unittest.TestCase): @@ -251,11 +251,11 @@ def testToAndFromString(self): self.sitemap_mobile_markup_language.text = 'HTML' - self.assert_(self.sitemap_mobile_markup_language.text == 'HTML') + self.assertTrue(self.sitemap_mobile_markup_language.text == 'HTML') new_sitemap_mobile_markup_language =\ webmastertools.SitemapMobileMarkupLanguageFromString( self.sitemap_mobile_markup_language.ToString()) - self.assert_(self.sitemap_mobile_markup_language.text ==\ + self.assertTrue(self.sitemap_mobile_markup_language.text ==\ new_sitemap_mobile_markup_language.text) @@ -266,10 +266,10 @@ def testToAndFromString(self): self.publication_label.text = 'Value1' - self.assert_(self.publication_label.text == 'Value1') + self.assertTrue(self.publication_label.text == 'Value1') new_publication_label = webmastertools.PublicationLabelFromString( self.publication_label.ToString()) - self.assert_(self.publication_label.text == new_publication_label.text) + self.assertTrue(self.publication_label.text == new_publication_label.text) class SitemapNewsTest(unittest.TestCase): @@ -280,17 +280,17 @@ def testToAndFromString(self): self.sitemap_news.publication_label.append(webmastertools.PublicationLabel( text = 'Value1')) - self.assert_(self.sitemap_news.text is None) - self.assert_(self.sitemap_news.publication_label[0].text == 'Value1') + self.assertTrue(self.sitemap_news.text is None) + self.assertTrue(self.sitemap_news.publication_label[0].text == 'Value1') new_sitemap_news = webmastertools.SitemapNewsFromString( self.sitemap_news.ToString()) - self.assert_(new_sitemap_news.text is None) - self.assert_(self.sitemap_news.publication_label[0].text == + self.assertTrue(new_sitemap_news.text is None) + self.assertTrue(self.sitemap_news.publication_label[0].text == new_sitemap_news.publication_label[0].text) def testConvertActualData(self): feed = webmastertools.SitemapsFeedFromString(test_data.SITEMAPS_FEED) - self.assert_(len(feed.sitemap_news.publication_label) == 3) + self.assertTrue(len(feed.sitemap_news.publication_label) == 3) check = 0 for publication_label in feed.sitemap_news.publication_label: if publication_label.text == "Value1": @@ -301,7 +301,7 @@ check = check | 4 else: self.fail('Unexpected publication label: %s' % markup_language.text) - self.assert_(check == 2 ** 3 - 1, + self.assertTrue(check == 2 ** 3 - 1, 'Something is wrong with publication label') @@ -313,11 +313,11 @@ def testToAndFromString(self): self.sitemap_news_publication_label.text = 'LabelValue' - self.assert_(self.sitemap_news_publication_label.text == 'LabelValue') + self.assertTrue(self.sitemap_news_publication_label.text == 'LabelValue') new_sitemap_news_publication_label =\ webmastertools.SitemapNewsPublicationLabelFromString( self.sitemap_news_publication_label.ToString()) - self.assert_(self.sitemap_news_publication_label.text ==\ + self.assertTrue(self.sitemap_news_publication_label.text ==\ new_sitemap_news_publication_label.text) @@ -328,12 +328,12 @@ def testToAndFromString(self): self.sitemap_last_downloaded.text = '2006-11-18T19:27:32.543Z' - self.assert_(self.sitemap_last_downloaded.text ==\ + self.assertTrue(self.sitemap_last_downloaded.text ==\ '2006-11-18T19:27:32.543Z') new_sitemap_last_downloaded =\ webmastertools.SitemapLastDownloadedFromString( self.sitemap_last_downloaded.ToString()) - self.assert_(self.sitemap_last_downloaded.text ==\ + self.assertTrue(self.sitemap_last_downloaded.text ==\ new_sitemap_last_downloaded.text) @@ -344,10 +344,10 @@ def testToAndFromString(self): self.sitemap_type.text = 'WEB' - self.assert_(self.sitemap_type.text == 'WEB') + self.assertTrue(self.sitemap_type.text == 'WEB') new_sitemap_type = webmastertools.SitemapTypeFromString( self.sitemap_type.ToString()) - self.assert_(self.sitemap_type.text == new_sitemap_type.text) + self.assertTrue(self.sitemap_type.text == new_sitemap_type.text) class SitemapStatusTest(unittest.TestCase): @@ -357,10 +357,10 @@ def testToAndFromString(self): self.sitemap_status.text = 'Pending' - self.assert_(self.sitemap_status.text == 'Pending') + self.assertTrue(self.sitemap_status.text == 'Pending') new_sitemap_status = webmastertools.SitemapStatusFromString( self.sitemap_status.ToString()) - self.assert_(self.sitemap_status.text == new_sitemap_status.text) + self.assertTrue(self.sitemap_status.text == new_sitemap_status.text) class SitemapUrlCountTest(unittest.TestCase): @@ -370,10 +370,10 @@ def testToAndFromString(self): self.sitemap_url_count.text = '0' - self.assert_(self.sitemap_url_count.text == '0') + self.assertTrue(self.sitemap_url_count.text == '0') new_sitemap_url_count = webmastertools.SitemapUrlCountFromString( self.sitemap_url_count.ToString()) - self.assert_(self.sitemap_url_count.text == new_sitemap_url_count.text) + self.assertTrue(self.sitemap_url_count.text == new_sitemap_url_count.text) class SitesEntryTest(unittest.TestCase): @@ -391,34 +391,34 @@ enhanced_image_search=webmastertools.EnhancedImageSearch(text='true'), verified=webmastertools.Verified(text='false'), ) - self.assert_(entry.indexed.text == 'true') - self.assert_(entry.crawled.text == '2008-09-14T08:59:28.000') - self.assert_(entry.geolocation.text == 'US') - self.assert_(entry.preferred_domain.text == 'none') - self.assert_(entry.crawl_rate.text == 'normal') - self.assert_(entry.enhanced_image_search.text == 'true') - self.assert_(entry.verified.text == 'false') + self.assertTrue(entry.indexed.text == 'true') + self.assertTrue(entry.crawled.text == '2008-09-14T08:59:28.000') + self.assertTrue(entry.geolocation.text == 'US') + self.assertTrue(entry.preferred_domain.text == 'none') + self.assertTrue(entry.crawl_rate.text == 'normal') + self.assertTrue(entry.enhanced_image_search.text == 'true') + self.assertTrue(entry.verified.text == 'false') new_entry = webmastertools.SitesEntryFromString(entry.ToString()) - self.assert_(new_entry.indexed.text == 'true') - self.assert_(new_entry.crawled.text == '2008-09-14T08:59:28.000') - self.assert_(new_entry.geolocation.text == 'US') - self.assert_(new_entry.preferred_domain.text == 'none') - self.assert_(new_entry.crawl_rate.text == 'normal') - self.assert_(new_entry.enhanced_image_search.text == 'true') - self.assert_(new_entry.verified.text == 'false') + self.assertTrue(new_entry.indexed.text == 'true') + self.assertTrue(new_entry.crawled.text == '2008-09-14T08:59:28.000') + self.assertTrue(new_entry.geolocation.text == 'US') + self.assertTrue(new_entry.preferred_domain.text == 'none') + self.assertTrue(new_entry.crawl_rate.text == 'normal') + self.assertTrue(new_entry.enhanced_image_search.text == 'true') + self.assertTrue(new_entry.verified.text == 'false') def testConvertActualData(self): feed = webmastertools.SitesFeedFromString(test_data.SITES_FEED) - self.assert_(len(feed.entry) == 1) + self.assertTrue(len(feed.entry) == 1) entry = feed.entry[0] - self.assert_(isinstance(entry, webmastertools.SitesEntry)) - self.assert_(entry.indexed.text == 'true') - self.assert_(entry.crawled.text == '2008-09-14T08:59:28.000') - self.assert_(entry.geolocation.text == 'US') - self.assert_(entry.preferred_domain.text == 'none') - self.assert_(entry.crawl_rate.text == 'normal') - self.assert_(entry.enhanced_image_search.text == 'true') - self.assert_(entry.verified.text == 'false') + self.assertTrue(isinstance(entry, webmastertools.SitesEntry)) + self.assertTrue(entry.indexed.text == 'true') + self.assertTrue(entry.crawled.text == '2008-09-14T08:59:28.000') + self.assertTrue(entry.geolocation.text == 'US') + self.assertTrue(entry.preferred_domain.text == 'none') + self.assertTrue(entry.crawl_rate.text == 'normal') + self.assertTrue(entry.enhanced_image_search.text == 'true') + self.assertTrue(entry.verified.text == 'false') class SitesFeedTest(unittest.TestCase): @@ -427,13 +427,13 @@ self.feed = gdata.webmastertools.SitesFeedFromString(test_data.SITES_FEED) def testToAndFromString(self): - self.assert_(len(self.feed.entry) == 1) + self.assertTrue(len(self.feed.entry) == 1) for entry in self.feed.entry: - self.assert_(isinstance(entry, webmastertools.SitesEntry)) + self.assertTrue(isinstance(entry, webmastertools.SitesEntry)) new_feed = webmastertools.SitesFeedFromString(self.feed.ToString()) - self.assert_(len(new_feed.entry) == 1) + self.assertTrue(len(new_feed.entry) == 1) for entry in new_feed.entry: - self.assert_(isinstance(entry, webmastertools.SitesEntry)) + self.assertTrue(isinstance(entry, webmastertools.SitesEntry)) class SitemapsEntryTest(unittest.TestCase): @@ -446,48 +446,48 @@ text='2006-11-18T19:27:32.543Z'), sitemap_url_count=webmastertools.SitemapUrlCount(text='102'), ) - self.assert_(entry.sitemap_type.text == 'WEB') - self.assert_(entry.sitemap_status.text == 'Pending') - self.assert_(entry.sitemap_last_downloaded.text ==\ + self.assertTrue(entry.sitemap_type.text == 'WEB') + self.assertTrue(entry.sitemap_status.text == 'Pending') + self.assertTrue(entry.sitemap_last_downloaded.text ==\ '2006-11-18T19:27:32.543Z') - self.assert_(entry.sitemap_url_count.text == '102') + self.assertTrue(entry.sitemap_url_count.text == '102') new_entry = webmastertools.SitemapsEntryFromString(entry.ToString()) - self.assert_(new_entry.sitemap_type.text == 'WEB') - self.assert_(new_entry.sitemap_status.text == 'Pending') - self.assert_(new_entry.sitemap_last_downloaded.text ==\ + self.assertTrue(new_entry.sitemap_type.text == 'WEB') + self.assertTrue(new_entry.sitemap_status.text == 'Pending') + self.assertTrue(new_entry.sitemap_last_downloaded.text ==\ '2006-11-18T19RefactoringTool: Refactored ./tests/gdata_tests/spreadsheets/live_client_test.py :27:32.543Z') - self.assert_(new_entry.sitemap_url_count.text == '102') + self.assertTrue(new_entry.sitemap_url_count.text == '102') def testConvertActualData(self): feed = gdata.webmastertools.SitemapsFeedFromString(test_data.SITEMAPS_FEED) - self.assert_(len(feed.entry) == 3) + self.assertTrue(len(feed.entry) == 3) for entry in feed.entry: - self.assert_(entry, webmastertools.SitemapsEntry) - self.assert_(entry.sitemap_status, webmastertools.SitemapStatus) - self.assert_(entry.sitemap_last_downloaded, + self.assertTrue(entry, webmastertools.SitemapsEntry) + self.assertTrue(entry.sitemap_status, webmastertools.SitemapStatus) + self.assertTrue(entry.sitemap_last_downloaded, webmastertools.SitemapLastDownloaded) - self.assert_(entry.sitemap_url_count, webmastertools.SitemapUrlCount) - self.assert_(entry.sitemap_status.text == 'StatusValue') - self.assert_(entry.sitemap_last_downloaded.text ==\ + self.assertTrue(entry.sitemap_url_count, webmastertools.SitemapUrlCount) + self.assertTrue(entry.sitemap_status.text == 'StatusValue') + self.assertTrue(entry.sitemap_last_downloaded.text ==\ '2006-11-18T19:27:32.543Z') - self.assert_(entry.sitemap_url_count.text == '102') + self.assertTrue(entry.sitemap_url_count.text == '102') if entry.id.text == 'http://www.example.com/sitemap-index.xml': - self.assert_(entry.sitemap_type, webmastertools.SitemapType) - self.assert_(entry.sitemap_type.text == 'WEB') - self.assert_(entry.sitemap_mobile_markup_language is None) - self.assert_(entry.sitemap_news_publication_label is None) + self.assertTrue(entry.sitemap_type, webmastertools.SitemapType) + self.assertTrue(entry.sitemap_type.text == 'WEB') + self.assertTrue(entry.sitemap_mobile_markup_language is None) + self.assertTrue(entry.sitemap_news_publication_label is None) elif entry.id.text == 'http://www.example.com/mobile/sitemap-index.xml': - self.assert_(entry.sitemap_mobile_markup_language, + self.assertTrue(entry.sitemap_mobile_markup_language, webmastertools.SitemapMobileMarkupLanguage) - self.assert_(entry.sitemap_mobile_markup_language.text == 'HTML') - self.assert_(entry.sitemap_type is None) - self.assert_(entry.sitemap_news_publication_label is None) + self.assertTrue(entry.sitemap_mobile_markup_language.text == 'HTML') + self.assertTrue(entry.sitemap_type is None) + self.assertTrue(entry.sitemap_news_publication_label is None) elif entry.id.text == 'http://www.example.com/news/sitemap-index.xml': - self.assert_(entry.sitemap_news_publication_label, + self.assertTrue(entry.sitemap_news_publication_label, webmastertools.SitemapNewsPublicationLabel) - self.assert_(entry.sitemap_news_publication_label.text == 'LabelValue') - self.assert_(entry.sitemap_type is None) - self.assert_(entry.sitemap_mobile_markup_language is None) + self.assertTrue(entry.sitemap_news_publication_label.text == 'LabelValue') + self.assertTrue(entry.sitemap_type is None) + self.assertTrue(entry.sitemap_mobile_markup_language is None) class SitemapsFeedTest(unittest.TestCase): @@ -497,13 +497,13 @@ test_data.SITEMAPS_FEED) def testToAndFromString(self): - self.assert_(len(self.feed.entry) == 3) + self.assertTrue(len(self.feed.entry) == 3) for entry in self.feed.entry: - self.assert_(isinstance(entry, webmastertools.SitemapsEntry)) + self.assertTrue(isinstance(entry, webmastertools.SitemapsEntry)) new_feed = webmastertools.SitemapsFeedFromString(self.feed.ToString()) - self.assert_(len(new_feed.entry) == 3) + self.assertTrue(len(new_feed.entry) == 3) for entry in new_feed.entry: - self.assert_(isinstance(entry, webmastertools.SitemapsEntry)) + self.assertTrue(isinstance(entry, webmastertools.SitemapsEntry)) if __name__ == '__main__': --- ./tests/gdata_tests/spreadsheets/live_client_test.py (original) +++ ./tests/gdata_tests/spreadsheets/live_client_test.py (refactored) @@ -55,14 +55,14 @@ spreadsheet_id = conf.options.get_value('spreadsheetid') original_worksheets = self.client.get_worksheets(spreadsheet_id) - self.assert_(isinstance(original_worksheets, + self.assertTrue(isinstance(original_worksheets, gdata.spreadsheets.data.WorksheetsFeed)) worksheet_count = int(original_worksheets.total_results.text) # Add a new worksheet to the spreadsheet. created = self.client.add_worksheet( spreadsheet_id, 'a test worksheet', 4, 8) - self.assert_(isinstance(created, + self.assertTrue(isinstance(created, gdata.spreadsheets.data.WorksheetEntry)) self.assertEqual(created.title.text, 'a test worksheet') self.assertEqual(created.row_count.text, '4') @@ -93,7 +93,7 @@ test_worksheet = self.client.add_worksheet( spreadsheet_id, 'worksheet x', rows=30, cols=3) - self.assert_(isinstance(tables, gdata.spreadsheets.data.TablesFeed)) + self.assertTrue(isinstance(tables, gdata.spreadsheets.data.TablesFeed)) initial_count = tables.total_results.text created_table = self.client.add_table( @@ -112,10 +112,10 @@ table_num = int(created_table.get_table_id()) starting_records = self.client.get_records(spreadsheet_id, table_num) self.assertEqual(starting_records.total_results.text, '10') - self.assert_(starting_records.entry[0].field[0].text is None) - self.assert_(starting_records.entry[0].field[1].text is None) - self.assert_(starting_records.entry[1].field[0].text is None) - self.assert_(starting_records.entry[1].field[1].text is None) + self.assertTrue(starting_records.entry[0].field[0].text is None) + self.assertTrue(starting_records.entry[0].field[1].text is None) + self.assertTrue(starting_records.entry[1].field[0].text is None) + self.assertTrue(starting_records.entry[1].field[1].text is None) record1 = self.client.add_record( spreadsheet_id, table_num, @@ -130,14 +130,14 @@ self.assertEqual(updated_records.entry[10].value_for_index('A'), '2.99') self.assertEqual(updated_records.entry[10].value_for_name('Drink'), 'Soda') - self.assert_(updated_records.entry[11].value_for_name('Price') is None) + self.assertTrue(updated_records.entry[11].value_for_name('Price') is None) self.assertEqual(updated_records.entry[11].value_for_name('Drink'), 'Milk') self.assertEqual(updated_records.entry[12].value_for_name('Drink'), 'Water') - self.assert_(updated_records.entry[1].value_for_index('A') is None) - self.assert_(updated_records.entry[2].value_for_index('B') is None) - self.assert_(updated_records.entry[3].value_for_index('C') is None) + self.assertTrue(updated_records.entry[1].value_for_index('A') is None) + self.assertTrue(updated_records.entry[2].value_for_index('B') is None) + self.assertTrue(updated_records.entry[3].value_for_index('C') is None) # Cleanup the table. self.client.delete(created_table) @@ -165,13 +165,13 @@ spreadsheet_id, test_worksheet.get_worksheet_id(), 1, 1) cell_entry.cell.input_value = 'a test' result = self.client.update(cell_entry) - self.assertEquals(cell_entry.cell.input_value, result.cell.input_value) + self.assertEqual(cell_entry.cell.input_value, result.cell.input_value) # Verify that the value was set. cells = self.client.get_cells( spreadsheet_id, test_worksheet.get_worksheet_id()) - self.assertEquals(len(cells.entry), 1) - self.assertEquals(cells.entry[0].cell.input_value, 'a test') + self.assertEqual(len(cells.entry), 1) + self.assertEqual(cells.entry[0].cell.input_value, 'a test') # Delete the test worksheet. self.client.delete(test_worksheet, force=True) @@ -179,9 +179,9 @@ def set_cell(self, spreadsheet_id, worksheet_id, row, column, value): cell_entry = self.cRefactoringTool: Refactored ./tests/gdata_tests/spreadsheets/data_test.py RefactoringTool: Refactored ./tests/gdata_tests/spreadsheet_test.py lient.get_cell( spreadsheet_id, worksheet_id, row, column) - self.assert_(cell_entry is not None) + self.assertTrue(cell_entry is not None) cell_entry.cell.input_value = value - self.assert_(self.client.update(cell_entry) is not None) + self.assertTrue(self.client.update(cell_entry) is not None) def test_batch_set_cells(self): if not conf.options.get_value('runlive') == 'true': @@ -227,25 +227,25 @@ entry = gdata.spreadsheets.data.ListEntry() entry.from_dict({'cola': 'alpha', 'colb': 'beta', 'colc': 'gamma'}) added = self.client.add_list_entry(entry, spreadsheet_id, worksheet_id) - self.assert_(isinstance(added, gdata.spreadsheets.data.ListEntry)) - self.assertEquals(added.get_value('cola'), 'alpha') + self.assertTrue(isinstance(added, gdata.spreadsheets.data.ListEntry)) + self.assertEqual(added.get_value('cola'), 'alpha') # Update the row. added.from_dict({'cola': '1', 'colb': '2', 'colc': '3'}) updated = self.client.update(added) - self.assert_(isinstance(updated, gdata.spreadsheets.data.ListEntry)) - self.assertEquals(updated.get_value('cola'), '1') + self.assertTrue(isinstance(updated, gdata.spreadsheets.data.ListEntry)) + self.assertEqual(updated.get_value('cola'), '1') # Check the number of rows. rows = self.client.get_list_feed(spreadsheet_id, worksheet_id) - self.assertEquals(len(rows.entry), 1) + self.assertEqual(len(rows.entry), 1) # Remove the row. self.client.delete(updated) # Check that it was removed. rows = self.client.get_list_feed(spreadsheet_id, worksheet_id) - self.assertEquals(len(rows.entry), 0) + self.assertEqual(len(rows.entry), 0) # Delete the test worksheet. self.client.delete(test_worksheet, force=True) --- ./tests/gdata_tests/spreadsheets/data_test.py (original) +++ ./tests/gdata_tests/spreadsheets/data_test.py (refactored) @@ -566,16 +566,16 @@ row.set_value('x', 'Test') self.assertEqual(row.get_value('x'), 'Test') row_xml = str(row) - self.assert_(row_xml.find(':x') > -1) - self.assert_(row_xml.find('>Test -1) - self.assert_(row_xml.find(':hours') > -1) - self.assert_(row_xml.find('>3 -1) - self.assert_(row_xml.find(':ipm') > -1) - self.assert_(row_xml.find('>1 -1) - self.assert_(row_xml.find(':items') > -1) - self.assert_(row_xml.find('>60 -1) - self.assert_(row_xml.find(':name') > -1) - self.assert_(row_xml.find('>Lizzy -1) + self.assertTrue(row_xml.find(':x') > -1) + self.assertTrue(row_xml.find('>Test -1) + self.assertTrue(row_xml.find(':hours') > -1) + self.assertTrue(row_xml.find('>3 -1) + self.assertTrue(row_xml.find(':ipm') > -1) + self.assertTrue(row_xml.find('>1 -1) + self.assertTrue(row_xml.find(':items') > -1) + self.assertTrue(row_xml.find('>60 -1) + self.assertTrue(row_xml.find(':name') > -1) + self.assertTrue(row_xml.find('>Lizzy -1) self.assertEqual(row_xml.find(':zzz'), -1) self.assertEqual(row_xml.find('>foo= 1) + self.assertTrue(len(db_list) >= 1) if len(db_list) >= 1: - self.assert_(db_list[0].entry.title.text == db_title) + self.assertTrue(db_list[0].entry.title.text == db_title) # Test finding the database using the spreadsheet key db_list = self.client.GetDatabases(spreadsheet_key=db.spreadsheet_key) - self.assert_(len(db_list) == 1) - self.assert_(db_list[0].entry.title.text == db_title) + self.assertTrue(len(db_list) == 1) + self.assertTrue(db_list[0].entry.title.text == db_title) # Delete the test spreadsheet time.sleep(10) db.Delete() @@ -73,12 +73,12 @@ table = self.db.CreateTable('test1', ['1','2','3']) # Try to get the new table using the worksheet id. table_list = self.db.GetTables(worksheet_id=table.worksheet_id) - self.assert_(len(table_list) == 1) - self.assert_(table_list[0].entry.title.text, 'test1') + self.assertTrue(len(table_list) == 1) + self.assertTrue(table_list[0].entry.title.text, 'test1') # Try to get the table using the name table_list = self.db.GetTables(name='test1') - self.assert_(len(table_list) == 1) - self.assert_(table_list[0].entry.title.text, 'test1') + self.assertTrue(len(table_list) == 1) + self.assertTrue(table_list[0].entry.title.text, 'test1') # Delete the table table.Delete() @@ -98,14 +98,14 @@ new_record = self.table.AddRecord({'a':'test1', 'b':'test2', 'cd':'test3', 'a_2':'test4', 'de':'test5'}) # Test getting record by line number. record = self.table.GetRecord(row_number=1) - self.assert_(record is not None) - self.assert_(record.content['a'] == 'test1') - self.assert_(record.content['b'] == 'test2') - self.assert_(record.content['cd'] == 'test3') - self.assert_(record.content['a_2'] == 'test4') + self.assertTrue(record is not None) + self.assertTrue(record.content['a'] == 'test1') + self.assertTrue(record.content['b'] == 'test2') + self.aRefactoringTool: Refactored ./tests/gdata_tests/spreadsheet/service_test.py ssertTrue(record.content['cd'] == 'test3') + self.assertTrue(record.content['a_2'] == 'test4') # Test getting record using the id. record_list = self.table.GetRecord(row_id=new_record.row_id) - self.assert_(record is not None) + self.assertTrue(record is not None) # Delete the record. time.sleep(10) new_record.Delete() @@ -121,14 +121,14 @@ # Try to get the changes before they've been committed second_copy.Pull() - self.assert_(second_copy.content['a'] == '1') - self.assert_(second_copy.content['b'] == '2') + self.assertTrue(second_copy.content['a'] == '1') + self.assertTrue(second_copy.content['b'] == '2') # Commit the changes, the content should now be different first_copy.Push() second_copy.Pull() - self.assert_(second_copy.content['a'] == '7') - self.assert_(second_copy.content['b'] == '9') + self.assertTrue(second_copy.content['a'] == '7') + self.assertTrue(second_copy.content['b'] == '9') # Make changes to the second copy, push, then try to push changes from # the first copy. @@ -141,7 +141,7 @@ self.fail() except gdata.spreadsheet.service.RequestError: pass - except Exception, error: + except Exception as error: #TODO: Why won't the except RequestError catch this? pass @@ -157,18 +157,18 @@ time.sleep(10) matches = self.table.FindRecords('a == 1') - self.assert_(len(matches) == 1) - self.assert_(matches[0].content['a'] == '1') - self.assert_(matches[0].content['b'] == '2') + self.assertTrue(len(matches) == 1) + self.assertTrue(matches[0].content['a'] == '1') + self.assertTrue(matches[0].content['b'] == '2') matches = self.table.FindRecords('a > 1 && cd < 20') - self.assert_(len(matches) == 4) + self.assertTrue(len(matches) == 4) matches = self.table.FindRecords('cd < de') - self.assert_(len(matches) == 7) + self.assertTrue(len(matches) == 7) matches = self.table.FindRecords('a == b') - self.assert_(len(matches) == 0) + self.assertTrue(len(matches) == 0) matches = self.table.FindRecords('a == 5') - self.assert_(len(matches) == 1) + self.assertTrue(len(matches) == 1) def testIterateResultSet(self): # Populate the table with test data. @@ -182,27 +182,27 @@ # Get the first two rows. records = self.table.GetRecords(1, 2) - self.assert_(len(records) == 2) - self.assert_(records[0].content['a'] == '1') - self.assert_(records[1].content['a'] == 'hi') + self.assertTrue(len(records) == 2) + self.assertTrue(records[0].content['a'] == '1') + self.assertTrue(records[1].content['a'] == 'hi') # Then get the next two rows. next_records = records.GetNext() - self.assert_(len(next_records) == 2) - self.assert_(next_records[0].content['a'] == '2') - self.assert_(next_records[0].content['cd'] == '3') - self.assert_(next_records[1].content['cd'] == '15') - self.assert_(next_records[1].content['de'] == '7') + self.assertTrue(len(next_records) == 2) + self.assertTrue(next_records[0].content['a'] == '2') + self.assertTrue(next_records[0].content['cd'] == '3') + self.assertTrue(next_records[1].content['cd'] == '15') + self.assertTrue(next_records[1].content['de'] == '7') def testLookupFieldsOnPreexistingTable(self): existing_table = self.db.GetTables(name='test1')[0] existing_table.LookupFields() - self.assertEquals(existing_table.fields, ['a', 'b', 'cd', 'a_2', 'de']) + self.assertEqual(existing_table.fields, ['a', 'b', 'cd', 'a_2', 'de']) if __name__ == '__main__': if not username: - username = raw_input('Spreadsheets API | Text DB Tests\n' + username = input('Spreadsheets API | Text DB Tests\n' 'Please enter your username: ') if not password: password = getpass.getpass() --- ./tests/gdata_tests/spreadsheet/service_test.py (original) +++ ./tests/gdata_tests/spreadsheet/service_test.py (refactored) @@ -42,13 +42,13 @@ def testTitle(self): self.query['title'] = 'my title' - self.assert_(self.query['title'] == 'my title') - self.assert_(self.query.ToUri() == '?title=my+title') + self.assertTrue(self.query['title'] == 'my title') + self.assertTrue(self.query.ToUri() == '?title=my+title') def testTitleExact(self): self.query['title-exact'] = 'true' - self.assert_(self.query['title-exact'] == 'true') - self.assert_(self.query.ToUri() == '?title-exact=true') + self.assertTrue(self.query['title-exact'] == 'true') + self.assertTrue(self.query.ToUri() == '?title-exact=true') class CellQueryTest(unittest.TestCase): @@ -58,33 +58,33 @@ def testMinRow(self): self.query['min-row'] = '1' - self.assert_(self.query['min-row'] == '1') - self.assert_(self.query.ToUri() == '?min-row=1') + self.assertTrue(self.query['min-row'] == '1') + self.assertTrue(self.query.ToUri() == '?min-row=1') def testMaxRow(self): self.query['max-row'] = '100' - self.assert_(self.query['max-row'] == '100') - self.assert_(self.query.ToUri() == '?max-row=100') + self.assertTrue(self.query['max-row'] == '100') + self.assertTrue(self.query.ToUri() == '?max-row=100') def testMinCol(self): self.query['min-col'] = '2' - self.assert_(self.query['min-col'] == '2') - self.assert_(self.query.ToUri() == '?min-col=2') + self.assertTrue(self.query['min-col'] == '2') + self.assertTrue(self.query.ToUri() == '?min-col=2') def testMaxCol(self): self.query['max-col'] = '20' - self.assert_(self.query['max-col'] == '20') - self.assert_(self.query.ToUri() == '?max-col=20') + self.assertTrue(self.query['max-col'] == '20') + self.assertTrue(self.query.ToUri() == '?max-col=20') def testRange(self): self.query['range'] = 'A1:B4' - self.assert_(self.query['range'] == 'A1:B4') - self.assert_(self.query.ToUri() == '?range=A1%3AB4') + self.assertTrue(self.query['range'] == 'A1:B4') + self.assertTrue(self.query.ToUri() == '?range=A1%3AB4') def testReturnEmpty(self): self.query['return-empty'] = 'false' - self.assert_(self.query['return-empty'] == 'false') - self.assert_(self.query.ToUri() == '?return-empty=false') + self.assertTrue(self.query['return-empty'] == 'false') + self.assertTrue(self.query.ToUri() == '?return-empty=false') class ListQueryTest(unittest.TestCase): @@ -94,18 +94,18 @@ def testSpreadsheetQuery(self): self.query['sq'] = 'first=john&last=smith' - self.assert_(self.query['sq'] == 'first=john&last=smith') - self.assert_(self.query.ToUri() == '?sq=first%3Djohn%26last%3Dsmith') + self.assertTrue(self.query['sq'] == 'first=john&last=smith') + self.assertTrue(self.query.ToUri() == '?sq=first%3Djohn%26last%3Dsmith') def testOrderByQuery(self): self.query['orderby'] = 'column:first' - self.assert_(self.query['orderby'] == 'column:first') - self.assert_(self.query.ToUri() == '?orderby=column%3Afirst') + self.assertTrue(self.query['orderby'] == 'column:first') + self.assertTrue(self.query.ToUri() == '?orderby=column%3Afirst') def testReverseQuery(self): self.query['reverse'] = 'true' - self.assert_(self.query['reverse'] == 'true') - self.assert_(self.query.ToUri() == '?reverse=true') + self.assertTrue(self.query['reverse'] == 'true') + self.assertTrue(self.query.ToUri() == '?reverse=true') class SpreadsheetsServiceTest(unittest.TestCase): @@ -121,25 +121,25 @@ def testGetSpreadsheetsFeed(self): entry = self.gd_client.GetSpreadsheetsFeed(self.key) - self.assert_(isinstance(entry, gdata.spreadsheet.SpreadsheetsSpreadsheet)) + self.assertTrue(isinstance(entry, gdata.spreadsheet.SpreadsheetsSpreadsheet)) def testGetWorksheetsFeed(self): feed = self.gd_client.GetWorksheetsFeed(self.key) - self.assert_(isinstance(feed, gdata.spreadsheet.SpreadsheetsWorksheetsFeed)) + self.assertTrue(isinstance(feed, gdata.spreadsheet.SpreadsheetsWorksheetsFeed)) entry = self.gd_client.GetWorksheetsFeed(self.key, self.worksheet) - self.assert_(isinstance(entry, gdata.spreadsheet.SpreadsheetsWorksheet)) + self.assertTrue(isinstance(entry, gdata.spreadsheet.SpreadsheetsWorksheet)) def testGetCellsFeed(self): feed = self.gd_client.GetCellsFeed(self.key) - self.assert_(isinstance(feed, gdata.spreadsheet.SpreadsheetsCellsFeed)) + self.assertTrue(isinstance(feed, gdata.spreadsheet.SpreadsheetsCellsFeed)) entry = self.gd_client.GetCellsFeed(self.key, cell='R5C1') - self.assert_(isinstance(entry, gdata.spreadsheet.SpreadsheetsCell)) + self.assertTrue(isinstance(entry, gdata.spreadsheet.SpreadsheetsCell)) def testGetListFeed(self): feed = self.gd_client.GetListFeed(self.key) - self.assert_(isinstance(feed, gdata.spreadsheet.SpreadsheetsListFeed)) + self.assertTrue(isinstance(feed, gdata.spreadsheet.SpreadsheetsListFeed)) entry = self.gd_client.GetListFeed(self.key, row_id='cpzh4') - self.assert_(isinstance(entry, gdata.spreadsheet.SpreadsheetsList)) + self.assertTrue(isinstance(entry, gdata.spreadsheet.SpreadsheetsList)) def testUpdateCell(self): self.gd_client.UpdateCell(row='5', col='1', inputValue='', key=self.key) @@ -157,8 +157,8 @@ batch_feed.AddUpdate(edit_cell) result = self.gd_client.ExecuteBatch(batch_feed, url=cell_feed.GetBatchLink().href) - self.assertEquals(len(result.entry), 1) - self.assertEquals(result.entry[0].cell.inputValue, 'New Value') + self.assertEqual(len(result.entry), 1) + self.assertEqual(result.entry[0].cell.inputValue, 'New Value') # Make a second batch request to change the cell's value back. edit_cell = result.entry[0] @@ -167,8 +167,8 @@ batch_feed.AddUpdate(edit_cell) restored = self.gd_client.ExecuteBatch(batch_feed, url=cell_feed.GetBatchLink().href) - self.assertEquals(len(restored.entry), 1) - self.assertEquals(restored.entry[0].cell.inputValue, old_cell_value) + self.assertEqual(len(restored.entry), 1) + self.assertEqual(restored.entry[0].cell.inputValue, old_cell_value) def testInsertUpdateRow(self): entry = self.gd_client.InsertRow({'a1':'new', 'b1':'row', 'c1':'was', @@ -182,21 +182,21 @@ # Add a new worksheet. new_worksheet = self.gd_client.AddWorksheet('worksheet_title_test_12', '2', 3, self.key) - self.assertEquals(new_worksheet.col_count.text, '3') - self.assertEquals(new_worksheet.row_count.text, '2') - self.assertEquals(new_worksheet.title.text, 'worksheet_title_test_12') + self.assertEqual(new_worksheet.col_count.text, '3') + self.assertEqual(new_worksheet.row_count.text, '2') + self.assertEqual(new_worksheet.title.text, 'worksheet_title_test_12') # Change the dimensions and title of the new worksheet. new_worksheet.col_count.text = '1' new_worksheet.title.text = 'edited worksheet test12' edited_worksheet = self.gd_client.UpdateWorksheet(new_worksheet) - self.assertEquals(edited_worksheet.col_count.text, '1') - self.assertEquals(edited_worksheet.row_count.text, '2') - self.assertEquals(edited_worksheet.title.text, 'edited worksheet test12') + self.assertEqual(edited_worksheet.col_count.text, '1') + self.assertEqual(edited_worksheet.row_count.text, '2') + self.assertEqual(edited_worksheet.title.text, 'edited worksheet test12') # Delete the new worksheet. result = self.gd_client.DeleteWorksheet(edited_worksheet) - self.assertEquals(result, True) + self.assertEqual(result, True) @@ -207,8 +207,8 @@ print ('These tests must be run on a sheet with this data:\n' 'a1,b1,c1,d1\n' '1,2,3,4') - username = raw_input('Please enter your username: ') + username = input('Please enter your username: ') password = getpass.getpass() - ss_key = raw_input('Please enter your spreadsheet key: ') - ws_key = raw_input('Please enter your worksheet key (usually od6): ') + ss_key = input('Please enter youRefactoringTool: Refactored ./tests/gdata_tests/sites/live_client_test.py RefactoringTool: Refactored ./tests/gdata_tests/sites/data_test.py r spreadsheet key: ') + ws_key = input('Please enter your worksheet key (usually od6): ') unittest.main() --- ./tests/gdata_tests/sites/live_client_test.py (original) +++ ./tests/gdata_tests/sites/live_client_test.py (refactored) @@ -61,7 +61,7 @@ self.assertEqual(new_entry.title.text, 'Title Of Page') self.assertEqual(new_entry.page_name.text, 'title-of-page') - self.assert_(new_entry.GetAlternateLink().href is not None) + self.assertTrue(new_entry.GetAlternateLink().href is not None) self.assertEqual(new_entry.Kind(), 'webpage') # Change the title of the webpage we just added. @@ -70,7 +70,7 @@ self.assertEqual(updated_entry.title.text, 'Edited') self.assertEqual(updated_entry.page_name.text, 'title-of-page') - self.assert_(isinstance(updated_entry, gdata.sites.data.ContentEntry)) + self.assertTrue(isinstance(updated_entry, gdata.sites.data.ContentEntry)) # Delete the test webpage from the Site. self.client.delete(updated_entry) @@ -88,7 +88,7 @@ self.assertEqual(filecabinet.title.text, 'FilesGoHere') self.assertEqual(filecabinet.page_name.text, 'diff-pagename-than-title') - self.assert_(filecabinet.GetAlternateLink().href is not None) + self.assertTrue(filecabinet.GetAlternateLink().href is not None) self.assertEqual(filecabinet.Kind(), 'filecabinet') # Upload a file to the filecabinet --- ./tests/gdata_tests/sites/data_test.py (original) +++ ./tests/gdata_tests/sites/data_test.py (refactored) @@ -39,7 +39,7 @@ def testToAndFromStringCommentEntry(self): self.assertEqual(self.entry.Kind(), 'comment') - self.assert_(isinstance(self.entry.in_reply_to, gdata.sites.data.InReplyTo)) + self.assertTrue(isinstance(self.entry.in_reply_to, gdata.sites.data.InReplyTo)) self.assertEqual(self.entry.in_reply_to.type, 'text/html') self.assertEqual( self.entry.FindParentLink(), @@ -62,7 +62,7 @@ gdata.sites.data.ContentEntry) def testToAndFromStringWithData(self): - self.assert_(isinstance(self.entry, gdata.sites.data.ContentEntry)) + self.assertTrue(isinstance(self.entry, gdata.sites.data.ContentEntry)) self.assertEqual(self.entry.title.text, 'ListPagesTitle') self.assertEqual(len(self.entry.author), 1) self.assertEqual(self.entry.author[0].name.text, 'Test User') @@ -71,15 +71,15 @@ self.assertEqual(self.entry.header.row, '1') self.assertEqual(self.entry.data.startRow, '2') self.assertEqual(len(self.entry.data.column), 5) - self.assert_(isinstance(self.entry.data.column[0], gdata.sites.data.Column)) + self.assertTrue(isinstance(self.entry.data.column[0], gdata.sites.data.Column)) self.assertEqual(self.entry.data.column[0].index, 'A') self.assertEqual(self.entry.data.column[0].name, 'Owner') - self.assert_(isinstance(self.entry.feed_link, gdata.data.FeedLink)) + self.assertTrue(isinstance(self.entry.feed_link, gdata.data.FeedLink)) self.assertEqual( self.entry.feed_link.href, 'http:///sites.google.com/feeds/content/site/gdatatestsite?parent=abc') - self.assert_(isinstance(self.entry.content, gdata.sites.data.Content)) - self.assert_(isinstance(self.entry.content.html, atom.core.XmlElement)) + self.assertTrue(isinstance(self.entry.content, gdata.sites.data.Content)) + self.assertTrue(isinstance(self.entry.content.html, atom.core.XmlElement)) self.assertEqual(self.entry.content.type, 'xhtml') @@ -90,9 +90,9 @@ gdata.sites.data.ContentEntry) def testToAndFromStringWithData(self): - self.assert_(isinstance(self.entry, gdata.sites.data.ContentEntry)) + self.assertTrue(isinstance(self.entry, gdata.sites.data.ContentEntry)) self.assertEqual(len(self.entry.field), 5) - self.assert_(isinstance(self.entry.field[0], gdata.sites.data.Field)) + self.assertTrue(isinstance(self.entry.field[0], gdata.sites.data.Field)) self.assertEqual(self.entry.field[0].index, 'A') self.assertEqual(self.entry.field[0].name, 'Owner') self.assertEqual(self.entry.field[0].text, 'test value') @@ -135,21 +135,21 @@ gdata.sites.data.ContentFeed) def testToAndFromStringContentFeed(self): - self.assert_(isinstance(self.feed, gdata.sites.data.ContentFeed)) + self.assertTrue(isinstance(self.feed, gdata.sites.data.ContentFeed)) self.assertEqual(len(self.feed.entry), 8) - self.assert_(isinstance(self.feed.entry[0].revision, + self.assertTrue(isinstance(self.feed.entry[0].revision, gdata.sites.data.Revision)) self.assertEqual(int(self.feed.entry[0].revision.text), 2) self.assertEqual(self.feed.entry[0].GetNodeId(), '1712987567114738703') - self.assert_(isinstance(self.feed.entry[0].page_name, + self.assertTrue(isinstance(self.feed.entry[0].page_name, gdata.sites.data.PageName)) self.assertEqual(self.feed.entry[0].page_name.text, 'home') self.assertEqual(self.feed.entry[0].FindRevisionLink(), 'http:///sites.google.com/feeds/content/site/gdatatestsite/12345') for entry in self.feed.entry: - self.assert_(isinstance(entry, gdata.sites.data.ContentEntry)) + self.assertTrue(isinstance(entry, gdata.sites.data.ContentEntry)) if entry.deleted is not None: - self.assert_(isinstance(entry.deleted, gdata.sites.data.Deleted)) + self.assertTrue(isinstance(entry.deleted, gdata.sites.data.Deleted)) self.assertEqual(entry.IsDeleted(), True) else: self.assertEqual(entry.IsDeleted(), False) @@ -158,16 +158,16 @@ new_entry = gdata.sites.data.ContentEntry() new_entry.content = gdata.sites.data.Content() new_entry.content.html = '

here is html

' - self.assert_(isinstance(new_entry, gdata.sites.data.ContentEntry)) - self.assert_(isinstance(new_entry.content, gdata.sites.data.Content)) - self.assert_(isinstance(new_entry.content.html, atom.core.XmlElement)) + self.assertTrue(isinstance(new_entry, gdata.sites.data.ContentEntry)) + self.assertTrue(isinstance(new_entry.content, gdata.sites.data.Content)) + self.assertTrue(isinstance(new_entry.content.html, atom.core.XmlElement)) new_entry2 = gdata.sites.data.ContentEntry() new_entry2.content = gdata.sites.data.Content( html='

here is html

') - self.assert_(isinstance(new_entry2, gdata.sites.data.ContentEntry)) - self.assert_(isinstance(new_entry2.content, gdata.sites.data.Content)) - self.assert_(isinstance(new_entry2.content.html, atom.core.XmlElement)) + self.assertTrue(isinstance(new_entry2, gdata.sites.data.ContentEntry)) + self.assertTrue(isinstance(new_entry2.content, gdata.sites.data.Content)) + self.assertTrue(isinstance(new_entry2.content.html, atom.core.XmlElement)) def testGetHelpers(self): kinds = {'announcement': self.feed.GetAnnouncements, @@ -179,7 +179,7 @@ 'listpage': self.feed.GetListPages, 'webpage': self.feed.GetWebpages} - for k, v in kinds.iteritems(): + for k, v in kinds.items(): entries = v() self.assertEqual(len(entries), 1) for entry in entries: @@ -196,12 +196,12 @@ gdata.sites.data.ActivityFeed) def testToAndFromStringActivityFeed(self): - self.assert_(isinstance(self.feed, gdata.sites.data.ActivityFeed)) + self.assertTrue(isinstance(self.feed, gdata.sites.data.ActivityFeed)) self.assertEqual(len(self.feed.entry), 2) for entry in self.feed.entry: - self.assert_(isinstance(entry.summary, gdata.sites.data.Summary)) + self.assertTrue(isinstance(entry.summary, gdata.sites.data.Summary)) self.assertEqual(entry.summary.type, 'xhtml') - self.assert_(isinstance(entry.summary.html, atom.core.XmlElement)) + self.assertTrue(isinstance(entry.summary.html, atom.core.XmlElement)) class RevisionFeedTest(unittest.TestCase): @@ -211,11 +211,11 @@ gdata.sites.data.RevisionFeed) def testToAndFromStringRevisionFeed(self): - self.assert_(isinstance(self.feed, gdata.sites.data.RevRefactoringTool: Refactored ./tests/gdata_tests/service_test.py isionFeed)) + self.assertTrue(isinstance(self.feed, gdata.sites.data.RevisionFeed)) self.assertEqual(len(self.feed.entry), 1) entry = self.feed.entry[0] - self.assert_(isinstance(entry.content, gdata.sites.data.Content)) - self.assert_(isinstance(entry.content.html, atom.core.XmlElement)) + self.assertTrue(isinstance(entry.content, gdata.sites.data.Content)) + self.assertTrue(isinstance(entry.content.html, atom.core.XmlElement)) self.assertEqual(entry.content.type, 'xhtml') self.assertEqual( entry.FindParentLink(), @@ -229,10 +229,10 @@ gdata.sites.data.SiteFeed) def testToAndFromStringSiteFeed(self): - self.assert_(isinstance(self.feed, gdata.sites.data.SiteFeed)) + self.assertTrue(isinstance(self.feed, gdata.sites.data.SiteFeed)) self.assertEqual(len(self.feed.entry), 2) entry = self.feed.entry[0] - self.assert_(isinstance(entry.site_name, gdata.sites.data.SiteName)) + self.assertTrue(isinstance(entry.site_name, gdata.sites.data.SiteName)) self.assertEqual(entry.title.text, 'New Test Site') self.assertEqual(entry.site_name.text, 'new-test-site') self.assertEqual( @@ -251,14 +251,14 @@ gdata.sites.data.AclFeed) def testToAndFromStringAclFeed(self): - self.assert_(isinstance(self.feed, gdata.sites.data.AclFeed)) + self.assertTrue(isinstance(self.feed, gdata.sites.data.AclFeed)) self.assertEqual(len(self.feed.entry), 1) entry = self.feed.entry[0] - self.assert_(isinstance(entry, gdata.sites.data.AclEntry)) - self.assert_(isinstance(entry.scope, gdata.acl.data.AclScope)) + self.assertTrue(isinstance(entry, gdata.sites.data.AclEntry)) + self.assertTrue(isinstance(entry.scope, gdata.acl.data.AclScope)) self.assertEqual(entry.scope.type, 'user') self.assertEqual(entry.scope.value, 'user@example.com') - self.assert_(isinstance(entry.role, gdata.acl.data.AclRole)) + self.assertTrue(isinstance(entry.role, gdata.acl.data.AclRole)) self.assertEqual(entry.role.value, 'owner') self.assertEqual( entry.GetSelfLink().href, --- ./tests/gdata_tests/service_test.py (original) +++ ./tests/gdata_tests/service_test.py (refactored) @@ -73,7 +73,7 @@ def testSourceGeneratesUserAgentHeader(self): self.gd_client.source = 'GoogleInc-ServiceUnitTest-1' - self.assert_(self.gd_client.additional_headers['User-Agent'].startswith( + self.assertTrue(self.gd_client.additional_headers['User-Agent'].startswith( 'GoogleInc-ServiceUnitTest-1 GData-Python')) def testMedia1(self): @@ -82,9 +82,9 @@ ms.setFile(test_image_location, 'image/jpeg') media_entry = self.gd_client.Post(None, self.album_entry.GetFeedLink().href, media_source = ms) - self.assert_(media_entry is not None) - self.assert_(isinstance(media_entry, gdata.GDataEntry)) - self.assert_(media_entry.IsMedia()) + self.assertTrue(media_entry is not None) + self.assertTrue(isinstance(media_entry, gdata.GDataEntry)) + self.assertTrue(media_entry.IsMedia()) # Update media & metadata ms = gdata.MediaSource() @@ -92,23 +92,23 @@ media_entry.summary = atom.Summary(text='Test Image') media_entry2 = self.gd_client.Put(media_entry, media_entry.GetEditLink().href, media_source = ms) - self.assert_(media_entry2 is not None) - self.assert_(isinstance(media_entry2, gdata.GDataEntry)) - self.assert_(media_entry2.IsMedia()) - self.assert_(media_entry2.summary.text == 'Test Image') + self.assertTrue(media_entry2 is not None) + self.assertTrue(isinstance(media_entry2, gdata.GDataEntry)) + self.assertTrue(media_entry2.IsMedia()) + self.assertTrue(media_entry2.summary.text == 'Test Image') # Read media binary imageSource = self.gd_client.GetMedia(media_entry2.GetMediaURL()) - self.assert_(isinstance(imageSource, gdata.MediaSource)) - self.assert_(imageSource.content_type == 'image/jpeg') - self.assert_(imageSource.content_length) + self.assertTrue(isinstance(imageSource, gdata.MediaSource)) + self.assertTrue(imageSource.content_type == 'image/jpeg') + self.assertTrue(imageSource.content_length) imageData = imageSource.file_handle.read() - self.assert_(imageData) + self.assertTrue(imageData) # Delete entry response = self.gd_client.Delete(media_entry2.GetEditLink().href) - self.assert_(response) + self.assertTrue(response) def testMedia2(self): # Create media & metadata @@ -122,43 +122,43 @@ 'http://schemas.google.com/photos/2007#photo')) media_entry = self.gd_client.Post(new_media_entry, self.album_entry.GetFeedLink().href, media_source = ms) - self.assert_(media_entry is not None) - self.assert_(isinstance(media_entry, gdata.GDataEntry)) - self.assert_(media_entry.IsMedia()) - self.assert_(media_entry.summary.text == 'Test Image') + self.assertTrue(media_entry is not None) + self.assertTrue(isinstance(media_entry, gdata.GDataEntry)) + self.assertTrue(media_entry.IsMedia()) + self.assertTrue(media_entry.summary.text == 'Test Image') # Update media only ms = gdata.MediaSource() ms.setFile(test_image_location, 'image/jpeg') media_entry = self.gd_client.Put(None, media_entry.GetEditMediaLink().href, media_source = ms) - self.assert_(media_entry is not None) - self.assert_(isinstance(media_entry, gdata.GDataEntry)) - self.assert_(media_entry.IsMedia()) + self.assertTrue(media_entry is not None) + self.assertTrue(isinstance(media_entry, gdata.GDataEntry)) + self.assertTrue(media_entry.IsMedia()) # Delete entry response = self.gd_client.Delete(media_entry.GetEditLink().href) - self.assert_(response) + self.assertTrue(response) def testMediaConstructorDefaults(self): ms = gdata.MediaSource() ms.setFile(test_image_location, 'image/jpeg') - self.assert_(ms is not None) - self.assert_(isinstance(ms, gdata.MediaSource)) - self.assertEquals(ms.file_name, test_image_name) - self.assertEquals(ms.content_type, 'image/jpeg') + self.assertTrue(ms is not None) + self.assertTrue(isinstance(ms, gdata.MediaSource)) + self.assertEqual(ms.file_name, test_image_name) + self.assertEqual(ms.content_type, 'image/jpeg') def testMediaConstructorWithFilePath(self): ms = gdata.MediaSource(file_path=test_image_location, content_type='image/jpeg') - self.assert_(ms is not None) - self.assert_(isinstance(ms, gdata.MediaSource)) - self.assertEquals(ms.file_name, test_image_name) - self.assertEquals(ms.content_type, 'image/jpeg') + self.assertTrue(ms is not None) + self.assertTrue(isinstance(ms, gdata.MediaSource)) + self.assertEqual(ms.file_name, test_image_name) + self.assertEqual(ms.content_type, 'image/jpeg') def testMediaConstructorWithFileHandle(self): @@ -166,10 +166,10 @@ len = os.path.getsize(test_image_location) ms = gdata.MediaSource(fh, 'image/jpeg', len, file_name=test_image_location) - self.assert_(ms is not None) - self.assert_(isinstance(ms, gdata.MediaSource)) - self.assertEquals(ms.file_name, test_image_location) - self.assertEquals(ms.content_type, 'image/jpeg') + self.assertTrue(ms is not None) + self.assertTrue(isinstance(ms, gdata.MediaSource)) + self.assertEqual(ms.file_name, test_image_location) + self.assertEqual(ms.content_type, 'image/jpeg') class GDataServiceUnitTest(unittest.TestCase): @@ -186,24 +186,24 @@ password_string = 'Passwd' self.gd_client.email = email_string - self.assertEquals(self.gd_client.email, email_string) + self.assertEqual(self.gd_client.email, email_string) self.gd_client.password = password_string - self.assertEquals(self.gd_client.password, password_string) + self.assertEqual(self.gd_client.password, password_string) def testCorrectLogin(self): try: self.gd_client.ProgrammaticLogin() - self.assert_(isinstance( + self.assertTrue(isinstance( self.gd_client.token_store.find_token( 'http://base.google.com/base/feeds/'), gdata.auth.ClientLoginToken)) - self.assert_(self.gd_client.captcha_token is None) - self.assert_(self.gd_client.captcha_url is None) + self.assertTrue(self.gd_client.captcha_token is None) + self.assertTrue(self.gd_client.captcha_url is None) except gdata.service.CaptchaRequired: self.fail('Required Captcha') def testDefaultHttpClient(self): - self.assert_(isinstance(self.gd_client.http_client, + self.assertTrue(isinstance(self.gd_client.http_client, atom.http.HttpClient)) @@ -223,8 +223,8 @@ 'VKlVrNhQ'} self.gd_client.server = 'base.google.com' result = self.gd_client.Get('/base/feeds/snippets?bq=digital+camera') - self.assert_(result is not None) - self.assert_(isinstance(result, atom.Feed)) + self.assertTrue(result is not None) + self.assertTrue(isinstance(result, atom.Feed)) def testGetWithAuthentication(self): try: @@ -242,8 +242,8 @@ 'VKlVrNhQ'} self.gd_client.server = 'base.google.com' result = self.gd_client.Get('/base/feeds/items?bq=digital+camera') - self.assert_(result is not None) - self.assert_(isinstance(result, atom.Feed)) + self.assertTrue(result is not None) + self.assertTrue(isinstance(result, atom.Feed)) def testGetEntry(self): try: @@ -273,15 +273,15 @@ self.fail('Login Error') self.gd_client.server = 'base.google.com' result = self.gd_client.GetFeed('/base/feeds/items?bq=digital+camera') - self.assert_(result is not None) - self.assert_(isinstance(result, atom.Feed)) + self.assertTrue(result is not None) + self.assertTrue(isinstance(result, atom.Feed)) def testGetWithResponseTransformer(self): # Query Google Base and interpret the results as a GBaseSnippetFeed. feed = self.gd_client.Get( 'http://www.google.com/base/feeds/snippets?bq=digital+camera', converter=gdata.base.GBaseSnippetFeedFromString) - self.assertEquals(isinstance(feed, gdata.base.GBaseSnippetFeed), True) + self.assertEqual(isinstance(feed, gdata.base.GBaseSnippetFeed), True) def testPostPutAndDelete(self): try: @@ -302,14 +302,14 @@ # Insert a new item response = self.gd_client.Post(test_data.TEST_BASE_ENTRY, '/base/feeds/items') - self.assert_(response is not None) - self.assert_(isinstance(response, atom.Entry)) - self.assert_(response.category[0].term == 'products') + self.assertTrue(response is not None) + self.assertTrue(isinstance(response, atom.Entry)) + self.assertTrue(response.category[0].term == 'products') # Find the item id of the created item item_id = response.id.text.lstrip( 'http://www.google.com/base/feeds/items/') - self.assert_(item_id is not None) + self.assertTrue(item_id is not None) updated_xml = gdata.base.GBaseItemFromString(test_data.TEST_BASE_ENTRY) # Change one of the labels in the item @@ -317,13 +317,13 @@ # Update the item response = self.gd_client.Put(updated_xml, '/base/feeds/items/%s' % item_id) - self.assert_(response is not None) + self.assertTrue(response is not None) new_base_item = gdata.base.GBaseItemFromString(str(response)) - self.assert_(isinstance(new_base_item, atom.Entry)) + self.assertTrue(isinstance(new_base_item, atom.Entry)) # Delete the item the test just created. response = self.gd_client.Delete('/base/feeds/items/%s' % item_id) - self.assert_(response) + self.assertTrue(response) def testPostPutAndDeleteWithConverters(self): try: @@ -344,10 +344,10 @@ # Insert a new item response = self.gd_client.Post(test_data.TEST_BASE_ENTRY, '/base/feeds/items', converter=gdata.base.GBaseItemFromString) - self.assert_(response is not None) - self.assert_(isinstance(response, atom.Entry)) - self.assert_(isinstance(response, gdata.base.GBaseItem)) - self.assert_(response.category[0].term == 'products') + self.assertTrue(response is not None) + self.assertTrue(isinstance(response, atom.Entry)) + self.assertTrue(isinstance(response, gdata.base.GBaseItem)) + self.assertTrue(response.category[0].term == 'products') updated_xml = gdata.base.GBaseItemFromString(test_data.TEST_BASE_ENTRY) # Change one of the labels in the item @@ -356,12 +356,12 @@ response = self.gd_client.Put(updated_xml, response.id.text, converter=gdata.base.GBaseItemFromString) - self.assertEquals(response is not None, True) - self.assertEquals(isinstance(response, gdata.base.GBaseItem), True) + self.assertEqual(response is not None, True) + self.assertEqual(isinstance(response, gdata.base.GBaseItem), True) # Delete the item the test just created. response = self.gd_client.Delete(response.id.text) - self.assert_(response) + self.assertTrue(response) def testCaptchaUrlGeneration(self): # Populate the mock server with a pairing for a ClientLogin request to a @@ -383,8 +383,8 @@ try: self.gd_client.ProgrammaticLogin() self.fail('Login attempt should have caused a CAPTCHA challenge.') - except gdata.service.CaptchaRequired, error: - self.assertEquals(self.gd_client.captcha_url, + except gdata.service.CaptchaRequired as error: + self.assertEqual(self.gd_client.captcha_url, ('https://www.google.com/accounts/Captcha?ctoken=HiteT4b0Bk5Xg18_' 'AcVoP6-yFkHPibe7O9EqxeiI7lUSN')) @@ -398,7 +398,7 @@ atom.mock_http_core.SettableHttpClient(200, 'OK', '', {})) def testDeleteWithUrlParams(self): - self.assert_(self.gd_client.Delete('http://example.com/test', + self.assertTrue(self.gd_client.Delete('http://example.com/test', {'TestHeader': '123'}, {'urlParam1': 'a', 'urlParam2': 'test'})) request = self.gd_client.http_client.v2_http_client.last_request self.assertEqual(request.uri.host, 'example.com') @@ -408,7 +408,7 @@ def testDeleteWithSessionId(self): self.gd_client._SetSessionId('test_session_id') - self.assert_(self.gd_client.Delete('http://example.com/test', + self.assertTrue(self.gd_client.Delete('http://example.com/test', {'TestHeader': '123'}, {'urlParam1': 'a', 'urlParam2': 'test'})) request = self.gd_client.http_client.v2_http_client.last_request self.assertEqual(request.uri.host, 'example.com') @@ -429,61 +429,61 @@ except KeyError: pass self.query['zap'] = 'x' - self.assert_(self.query['zap'] == 'x') + self.assertTrue(self.query['zap'] == 'x') def testContructorShouldRejectBadInputs(self): test_q = gdata.service.Query(params=[1,2,3,4]) - self.assert_(len(test_q.keys()) == 0) + self.assertTrue(len(list(test_q.keys())) == 0) def testTextQueryProperty(self): - self.assert_(self.query.text_query is None) + self.assertTrue(self.query.text_query is None) self.query['q'] = 'test1' - self.assert_(self.query.text_query == 'test1') + self.assertTrue(self.query.text_query == 'test1') self.query.text_query = 'test2' - self.assert_(self.query.text_query == 'test2') + self.assertTrue(self.query.text_query == 'test2') def testOrderByQueryProperty(self): - self.assert_(self.query.orderby is None) + self.assertTrue(self.query.orderby is None) self.query['orderby'] = 'updated' - self.assert_(self.query.orderby == 'updated') + self.assertTrue(self.query.orderby == 'updated') self.query.orderby = 'starttime' - self.assert_(self.query.orderby == 'starttime') + self.assertTrue(self.query.orderby == 'starttime') def testQueryShouldProduceExampleUris(self): self.query.feed = '/base/feeds/snippets' self.query.text_query = 'This is a test' - self.assert_(self.query.ToUri() == '/base/feeds/snippets?q=This+is+a+test') + self.assertTrue(self.query.ToUri() == '/base/feeds/snippets?q=This+is+a+test') def testCategoriesFormattedCorrectly(self): self.query.feed = '/x' self.query.categories.append('Fritz') self.query.categories.append('Laurie') - self.assert_(self.query.ToUri() == '/x/-/Fritz/Laurie') + self.assertTrue(self.query.ToUri() == '/x/-/Fritz/Laurie') # The query's feed should not have been changed - self.assert_(self.query.feed == '/x') - self.assert_(self.query.ToUri() == '/x/-/Fritz/Laurie') + self.assertTrue(self.query.feed == '/x') + self.assertTrue(self.query.ToUri() == '/x/-/Fritz/Laurie') def testCategoryQueriesShouldEscapeOrSymbols(self): self.query.feed = '/x' self.query.categories.append('Fritz|Laurie') - self.assert_(self.query.ToUri() == '/x/-/Fritz%7CLaurie') + self.assertTrue(self.query.ToUri() == '/x/-/Fritz%7CLaurie') def testTypeCoercionOnIntParams(self): self.query.feed = '/x' self.query.max_results = 10 self.query.start_index = 5 - self.assert_(isinstance(self.query.max_results, str)) - self.assert_(isinstance(self.query.start_index, str)) - self.assertEquals(self.query['max-results'], '10') - self.assertEquals(self.query['start-index'], '5') + self.assertTrue(isinstance(self.query.max_results, str)) + self.assertTrue(isinstance(self.query.start_index, str)) + self.assertEqual(self.query['max-results'], '10') + self.assertEqual(self.query['start-index'], '5') def testPassInCategoryListToConstructor(self): query = gdata.service.Query(feed='/feed/sample', categories=['foo', 'bar', 'eggs|spam']) url = query.ToUri() - self.assert_(url.find('/foo') > -1) - self.assert_(url.find('/bar') > -1) - self.assert_(url.find('/eggs%7Cspam') > -1) + self.assertTrue(url.find('/foo') > -1) + self.assertTrue(url.find('/bar') > -1) + self.assertTrue(url.find('/eggs%7Cspam') > -1) class GetNextPageInFeedTest(unittest.TestCase): @@ -495,24 +495,24 @@ feed = self.gd_client.Get( 'http://www.google.com/base/feeds/snippets?max-results=2', converter=gdata.base.GBaseSnippetFeedFromString) - self.assert_(len(feed.entry) > 0) + self.assertTrue(len(feed.entry) > 0) first_id = feed.entry[0].id.text feed2 = self.gd_client.GetNext(feed) - self.assert_(len(feed2.entry) > 0) + self.assertTrue(len(feed2.entry) > 0) next_id = feed2.entry[0].id.text - self.assert_(first_id != next_id) - self.assert_(feed2.__class__ == feed.__class__) + self.assertTrue(first_id != next_id) + self.assertTrue(feed2.__class__ == feed.__class__) class ScopeLookupTest(unittest.TestCase): def testLookupScopes(self): scopes = gdata.service.lookup_scopes('cl') - self.assertEquals(scopes, gdata.service.CLIENT_LOGIN_SCOPES['cl']) + self.assertEqual(scopes, gdata.service.CLIENT_LOGIN_SCOPES['cl']) scopes = gdata.service.lookup_scopes(None) - self.assert_(scopes is None) + self.assertTrue(scopes is None) scopes = gdata.service.lookup_scopes('UNKNOWN_SERVICE') - self.assert_(scopes is None) + self.assertTrue(scopes is None) class TokenLookupTest(unittest.TestCase): @@ -521,36 +521,36 @@ self.client = gdata.service.GDataService() def testSetAndGetClientLoginTokenWithNoService(self): - self.assert_(self.client.auth_token is None) + self.assertTrue(self.client.auth_token is None) self.client.SetClientLoginToken('foo') - self.assert_(self.client.auth_token is None) - self.assert_(self.client.token_store.find_token( + self.assertTrue(self.client.auth_token is None) + self.assertTrue(self.client.token_store.find_token( atom.token_store.SCOPE_ALL) is not None) - self.assertEquals(self.client.GetClientLoginToken(), 'foo') + self.assertEqual(self.client.GetClientLoginToken(), 'foo') self.client.SetClientLoginToken('foo2') - self.assertEquals(self.client.GetClientLoginToken(), 'foo2') + self.assertEqual(self.client.GetClientLoginToken(), 'foo2') def testSetAndGetClientLoginTokenWithService(self): self.client.service = 'cp' self.client.SetClientLoginToken('bar') - self.assertEquRefactoringTool: Refactored ./tests/gdata_tests/sample_util_test.py RefactoringTool: Refactored ./tests/gdata_tests/resumable_upload_test.py als(self.client.GetClientLoginToken(), 'bar') + self.assertEqual(self.client.GetClientLoginToken(), 'bar') # Changing the service should cause the token to no longer be found. self.client.service = 'gbase' self.client.current_token = None - self.assert_(self.client.GetClientLoginToken() is None) + self.assertTrue(self.client.GetClientLoginToken() is None) def testSetAndGetClientLoginTokenWithScopes(self): scopes = gdata.service.CLIENT_LOGIN_SCOPES['cl'][:] scopes.extend(gdata.service.CLIENT_LOGIN_SCOPES['gbase']) self.client.SetClientLoginToken('baz', scopes=scopes) self.client.current_token = None - self.assert_(self.client.GetClientLoginToken() is None) + self.assertTrue(self.client.GetClientLoginToken() is None) self.client.service = 'cl' - self.assertEquals(self.client.GetClientLoginToken(), 'baz') + self.assertEqual(self.client.GetClientLoginToken(), 'baz') self.client.service = 'gbase' - self.assertEquals(self.client.GetClientLoginToken(), 'baz') + self.assertEqual(self.client.GetClientLoginToken(), 'baz') self.client.service = 'wise' - self.assert_(self.client.GetClientLoginToken() is None) + self.assertTrue(self.client.GetClientLoginToken() is None) def testLookupUsingTokenStore(self): scopes = gdata.service.CLIENT_LOGIN_SCOPES['cl'][:] @@ -558,20 +558,20 @@ self.client.SetClientLoginToken('baz', scopes=scopes) token = self.client.token_store.find_token( 'http://www.google.com/calendar/feeds/foo') - self.assertEquals(token.get_token_string(), 'baz') - self.assertEquals(token.auth_header, '%s%s' % ( + self.assertEqual(token.get_token_string(), 'baz') + self.assertEqual(token.auth_header, '%s%s' % ( gdata.auth.PROGRAMMATIC_AUTH_LABEL, 'baz')) token = self.client.token_store.find_token( 'http://www.google.com/calendar/') - self.assert_(isinstance(token, gdata.auth.ClientLoginToken) == False) + self.assertTrue(isinstance(token, gdata.auth.ClientLoginToken) == False) token = self.client.token_store.find_token( 'http://www.google.com/base/feeds/snippets') - self.assertEquals(token.get_token_string(), 'baz') + self.assertEqual(token.get_token_string(), 'baz') if __name__ == '__main__': print ('GData Service Media Unit Tests\nNOTE: Please run these tests only ' 'with a test account. The tests may delete or update your data.') - username = raw_input('Please enter your username: ') + username = input('Please enter your username: ') password = getpass.getpass() unittest.main() --- ./tests/gdata_tests/sample_util_test.py (original) +++ ./tests/gdata_tests/sample_util_test.py (refactored) @@ -32,18 +32,18 @@ self.settings = gdata.sample_util.SettingsUtil() def test_get_param(self): - self.assert_(self.settings.get_param('missing', ask=False) is None) + self.assertTrue(self.settings.get_param('missing', ask=False) is None) self.settings.prefs['x'] = 'something' self.assertEqual(self.settings.get_param('x'), 'something') def test_get_param_from_command_line_arg(self): - self.assert_('x' not in self.settings.prefs) - self.assert_(self.settings.get_param('x', ask=False) is None) + self.assertTrue('x' not in self.settings.prefs) + self.assertTrue(self.settings.get_param('x', ask=False) is None) sys.argv.append('--x=something') self.assertEqual(self.settings.get_param('x'), 'something') - self.assert_('x' not in self.settings.prefs) - self.assert_('y' not in self.settings.prefs) - self.assert_(self.settings.get_param('y', ask=False) is None) + self.assertTrue('x' not in self.settings.prefs) + self.assertTrue('y' not in self.settings.prefs) + self.assertTrue(self.settings.get_param('y', ask=False) is None) sys.argv.append('--y') sys.argv.append('other') self.assertEqual(self.settings.get_param('y', reuse=True), 'other') --- ./tests/gdata_tests/resumable_upload_test.py (original) +++ ./tests/gdata_tests/resumable_upload_test.py (refactored) @@ -8RefactoringTool: Refactored ./tests/gdata_tests/projecthosting/live_client_test.py RefactoringTool: Refactored ./tests/gdata_tests/projecthosting/data_test.py 7,7 +87,7 @@ # Verify upload has really completed. self.assertEqual(uploader.QueryUploadStatus(), True) - self.assert_(isinstance(entry, gdata.docs.data.DocsEntry)) + self.assertTrue(isinstance(entry, gdata.docs.data.DocsEntry)) self.assertEqual(entry.title.text, 'MyResumableTitleEntireFile') self.assertEqual(entry.GetDocumentType(), 'document') self.assertEqual(entry.writers_can_invite.value, 'false') @@ -120,7 +120,7 @@ # Verify upload has really completed. self.assertEqual(uploader.QueryUploadStatus(), True) - self.assert_(isinstance(entry, gdata.docs.data.DocsEntry)) + self.assertTrue(isinstance(entry, gdata.docs.data.DocsEntry)) self.assertEqual(entry.title.text, 'MyManualChunksNoAtomTitle') self.assertEqual(entry.GetDocumentType(), 'document') self.client.Delete(entry, force=True) --- ./tests/gdata_tests/projecthosting/live_client_test.py (original) +++ ./tests/gdata_tests/projecthosting/live_client_test.py (refactored) @@ -99,14 +99,14 @@ self.assertEqual(updates.status.text, 'Accepted') # Make sure it got all our label change requests. - self.assertEquals(len(updates.label), 2) - self.assertEquals(updates.label[0].text, '-label0') - self.assertEquals(updates.label[1].text, 'label1') + self.assertEqual(len(updates.label), 2) + self.assertEqual(updates.label[0].text, '-label0') + self.assertEqual(updates.label[1].text, 'label1') # Be sure it saw our CC change. We can't check the specific values (yet) # because ccUpdate and ownerUpdate responses are mungled. - self.assertEquals(len(updates.ccUpdate), 1) - self.assert_(updates.ownerUpdate.text) + self.assertEqual(len(updates.ccUpdate), 1) + self.assertTrue(updates.ownerUpdate.text) def test_get_issues(self): if not conf.options.get_value('runlive') == 'true': @@ -126,11 +126,11 @@ feed = self.client.get_issues(self.project_name, query=query) # Make sure we at least find the entry we created with that label. - self.assert_(len(feed.entry) > 0) + self.assertTrue(len(feed.entry) > 0) for issue in feed.entry: label_texts = [label.text for label in issue.label] - self.assert_('label0' in label_texts, 'Issue does not have label label0') + self.assertTrue('label0' in label_texts, 'Issue does not have label label0') def test_get_comments(self): if not conf.options.get_value('runlive') == 'true': @@ -212,14 +212,14 @@ """Retrieve all the issues in a project.""" feed = client.get_issues(project_name) for issue in feed.entry: - self.assert_(issue.title.text is not None) + self.assertTrue(issue.title.text is not None) def retrieving_issues_using_query_parameters(self, client, project_name): """Retrieve a set of issues in a project.""" query = gdata.projecthosting.client.Query(label='label0', max_results=1000) feed = client.get_issues(project_name, query=query) for issue in feed.entry: - self.assert_(issue.title.text is not None) + self.assertTrue(issue.title.text is not None) return feed def retrieving_issues_comments_for_an_issue(self, client, project_name, @@ -227,7 +227,7 @@ """Retrieve all issue comments for an issue.""" comments_feed = client.get_comments(project_name, issue_id) for comment in comments_feed.entry: - self.assert_(comment.content is not None) + self.assertTrue(comment.content is not None) return comments_feed def modifying_an_issue_or_creating_issue_comments(self, client, project_name, --- ./tests/gdata_tests/projecthosting/data_test.py (original) +++ ./tests/gdata_tests/projecthosting/data_test.py (refactored) @@ -111,20 +111,20 @@ updates = entry.updates - self.assertEquals(updates.summary.text, 'This is updated issue summary') - self.assertEquals(updates.status.text, 'Started') - self.assertEquals(updates.ownerUpdate.text, 'charlotte.lucas') + self.assertEqual(updates.summary.text, 'This is updated issue summary') + self.assertEqual(updates.status.texRefactoringTool: Refactored ./tests/gdata_tests/photos_test.py t, 'Started') + self.assertEqual(updates.ownerUpdate.text, 'charlotte.lucas') - self.assertEquals(len(updates.label), 5) - self.assertEquals(updates.label[0].text, '-Type-Defect') - self.assertEquals(updates.label[1].text, 'Type-Enhancement') - self.assertEquals(updates.label[2].text, '-Milestone-2009') - self.assertEquals(updates.label[3].text, '-Priority-Medium') - self.assertEquals(updates.label[4].text, 'Priority-Low') + self.assertEqual(len(updates.label), 5) + self.assertEqual(updates.label[0].text, '-Type-Defect') + self.assertEqual(updates.label[1].text, 'Type-Enhancement') + self.assertEqual(updates.label[2].text, '-Milestone-2009') + self.assertEqual(updates.label[3].text, '-Priority-Medium') + self.assertEqual(updates.label[4].text, 'Priority-Low') - self.assertEquals(len(updates.ccUpdate), 2) - self.assertEquals(updates.ccUpdate[0].text, '-fitzwilliam.darcy') - self.assertEquals(updates.ccUpdate[1].text, 'marialucas@domain.com') + self.assertEqual(len(updates.ccUpdate), 2) + self.assertEqual(updates.ccUpdate[0].text, '-fitzwilliam.darcy') + self.assertEqual(updates.ccUpdate[1].text, 'marialucas@domain.com') class IssueEntryTest(unittest.TestCase): @@ -132,24 +132,24 @@ def testParsing(self): entry = atom.core.parse(ISSUE_ENTRY, gdata.projecthosting.data.IssueEntry) - self.assertEquals(entry.owner.uri.text, '/u/charlotte.lucas/') + self.assertEqual(entry.owner.uri.text, '/u/charlotte.lucas/') self.assertEqual(entry.owner.username.text, 'charlotte.lucas') - self.assertEquals(len(entry.cc), 2) + self.assertEqual(len(entry.cc), 2) cc_0 = entry.cc[0] - self.assertEquals(cc_0.uri.text, '/u/@UBhTQl1UARRAVga7/') - self.assertEquals(cc_0.username.text, 'mar...@domain.com') + self.assertEqual(cc_0.uri.text, '/u/@UBhTQl1UARRAVga7/') + self.assertEqual(cc_0.username.text, 'mar...@domain.com') cc_1 = entry.cc[1] - self.assertEquals(cc_1.uri.text, '/u/fitzwilliam.darcy/') - self.assertEquals(cc_1.username.text, 'fitzwilliam.darcy') + self.assertEqual(cc_1.uri.text, '/u/fitzwilliam.darcy/') + self.assertEqual(cc_1.username.text, 'fitzwilliam.darcy') - self.assertEquals(len(entry.label), 2) - self.assertEquals(entry.label[0].text, 'Type-Enhancement') - self.assertEquals(entry.label[1].text, 'Priority-Low') + self.assertEqual(len(entry.label), 2) + self.assertEqual(entry.label[0].text, 'Type-Enhancement') + self.assertEqual(entry.label[1].text, 'Priority-Low') - self.assertEquals(entry.stars.text, '0') - self.assertEquals(entry.state.text, 'open') - self.assertEquals(entry.status.text, 'Started') + self.assertEqual(entry.stars.text, '0') + self.assertEqual(entry.state.text, 'open') + self.assertEqual(entry.status.text, 'Started') class DataClassSanityTest(unittest.TestCase): --- ./tests/gdata_tests/photos_test.py (original) +++ ./tests/gdata_tests/photos_test.py (refactored) @@ -29,12 +29,12 @@ self.album_feed = gdata.photos.AlbumFeedFromString(test_data.ALBUM_FEED) def testCorrectXmlParsing(self): - self.assert_(self.album_feed.id.text == 'http://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1') - self.assert_(self.album_feed.gphoto_id.text == '1') - self.assert_(len(self.album_feed.entry) == 4) + self.assertTrue(self.album_feed.id.text == 'http://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1') + self.assertTrue(self.album_feed.gphoto_id.text == '1') + self.assertTrue(len(self.album_feed.entry) == 4) for entry in self.album_feed.entry: if entry.id.text == 'http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/2': - self.assert_(entry.summary.text == 'Blue') + self.assertTrue(entry.summary.text == 'Blue') class PhotoFeedTest(unittest.TestCase): @@ -45,12 +45,12 @@ def testCorrectXmlParsing(self): for entry in self.feed.entry: if entry.id.text == 'http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/2': - RefactoringTool: Refactored ./tests/gdata_tests/photos/service_test.py RefactoringTool: Refactored ./tests/gdata_tests/oauth/data_test.py RefactoringTool: No changes to ./tests/gdata_tests/marketplace/live_client_test.py RefactoringTool: Refactored ./tests/gdata_tests/live_client_test.py self.assert_(entry.gphoto_id.text == '2') - self.assert_(entry.albumid.text == '1') - self.assert_(entry.exif.flash.text == 'true') - self.assert_(entry.media.title.type == 'plain') - self.assert_(entry.media.title.text == 'Aqua Blue.jpg') - self.assert_(len(entry.media.thumbnail) == 3) + self.assertTrue(entry.gphoto_id.text == '2') + self.assertTrue(entry.albumid.text == '1') + self.assertTrue(entry.exif.flash.text == 'true') + self.assertTrue(entry.media.title.type == 'plain') + self.assertTrue(entry.media.title.text == 'Aqua Blue.jpg') + self.assertTrue(len(entry.media.thumbnail) == 3) @@ -62,7 +62,7 @@ def testEntryTypeConversion(self): for entry in self.feed.entry: if entry.id.text == 'http://picasaweb.google.com/data/feed/api/user/sample.user/albumid/': - self.assert_(isinstance(entry, gdata.photos.PhotoEntry)) + self.assertTrue(isinstance(entry, gdata.photos.PhotoEntry)) if __name__ == '__main__': --- ./tests/gdata_tests/photos/service_test.py (original) +++ ./tests/gdata_tests/photos/service_test.py (refactored) @@ -19,7 +19,7 @@ import getpass import time import unittest -import StringIO +import io import gdata.photos.service import gdata.photos import atom @@ -49,9 +49,9 @@ def testUploadGetAndDeletePhoto(self): image_entry = self.client.InsertPhotoSimple(self.test_album, 'test', 'a pretty testing picture', test_image_location) - self.assert_(image_entry.title.text == 'test') + self.assertTrue(image_entry.title.text == 'test') results_feed = self.client.SearchUserPhotos('test') - self.assert_(len(results_feed.entry) > 0) + self.assertTrue(len(results_feed.entry) > 0) self.client.Delete(image_entry) def testInsertPhotoUpdateBlobAndDelete(self): @@ -63,9 +63,9 @@ term='http://schemas.google.com/photos/2007#photo')) entry = self.client.InsertPhoto(self.test_album, new_entry, test_image_location, content_type='image/jpeg') - self.assert_(entry.id.text) + self.assertTrue(entry.id.text) updated_entry = self.client.UpdatePhotoBlob(entry, test_image_location) - self.assert_(entry.GetEditLink().href != updated_entry.GetEditLink().href) + self.assertTrue(entry.GetEditLink().href != updated_entry.GetEditLink().href) self.client.Delete(updated_entry) def tearDown(self): @@ -77,6 +77,6 @@ if __name__ == '__main__': print ('Google Photos test\nNOTE: Please run these tests only with a test ' 'account. The tests may delete or update your data.') - username = raw_input('Please enter your username: ') + username = input('Please enter your username: ') password = getpass.getpass() unittest.main() --- ./tests/gdata_tests/oauth/data_test.py (original) +++ ./tests/gdata_tests/oauth/data_test.py (refactored) @@ -170,8 +170,8 @@ def test_get_nonoauth_parameters(self): non_oauth_params = self.oauth_request.get_nonoauth_parameters() - self.assertTrue(non_oauth_params.has_key(self.non_oauth_param_message)) - self.assertFalse(non_oauth_params.has_key(OAuthParameters.CONSUMER_KEY)) + self.assertTrue(self.non_oauth_param_message in non_oauth_params) + self.assertFalse(OAuthParameters.CONSUMER_KEY in non_oauth_params) def test_to_header(self): realm = 'google' @@ -185,7 +185,7 @@ self.assertTrue(header_with_realm.find(k) > -1) def check_for_params_in_string(self, params, s): - for k, v in params.iteritems(): + for k, v in params.items(): self.assertTrue(s.find(oauth.escape(k)) > -1) self.assertTrue(s.find(oauth.escape(v)) > -1) @@ -209,7 +209,7 @@ key_values = [tuple(kv.split('=')) for kv in normalized_params.split('&')] del _params[OAuthParameters.SIGNATURE] - expected_key_values = _params.items() + expected_key_values = list(_params.items()) expected_key_values.sort() for k, v in expected_key_values: --- ./tests/gdata_tests/live_client_test.py (original) +++ ./tests/gdata_tesRefactoringTool: Refactored ./tests/gdata_tests/health_test.py ts/live_client_test.py (refactored) @@ -62,8 +62,8 @@ http_request.add_body_part(str(blog_post), 'application/atom+xml') def entry_from_string_wrapper(response): - self.assert_(response.getheader('content-type') is not None) - self.assert_(response.getheader('gdata-version') is not None) + self.assertTrue(response.getheader('content-type') is not None) + self.assertTrue(response.getheader('gdata-version') is not None) return atom.EntryFromString(response.read()) entry = self.client.request('POST', @@ -137,8 +137,8 @@ found_tags[0] = True elif category.get_attributes('term')[0].value == 'Mr. Darcy': found_tags[1] = True - self.assert_(found_tags[0]) - self.assert_(found_tags[1]) + self.assertTrue(found_tags[0]) + self.assertTrue(found_tags[1]) # Find the blog post on the blog. self_link = None @@ -148,8 +148,8 @@ self_link = link.get_attributes('href')[0].value elif link.get_attributes('rel')[0].value == 'edit': edit_link = link.get_attributes('href')[0].value - self.assert_(self_link is not None) - self.assert_(edit_link is not None) + self.assertTrue(self_link is not None) + self.assertTrue(edit_link is not None) queried = self.client.request('GET', self_link, converter=element_from_string) @@ -157,7 +157,7 @@ # Test queries using ETags. entry = self.client.get_entry(self_link) - self.assert_(entry.etag is not None) + self.assertTrue(entry.etag is not None) self.assertRaises(gdata.client.NotModified, self.client.get_entry, self_link, etag=entry.etag) @@ -205,12 +205,12 @@ self_link = link.get_attributes('href')[0].value elif link.get_attributes('rel')[0].value == 'edit': edit_link = link.get_attributes('href')[0].value - self.assert_(self_link is not None) - self.assert_(edit_link is not None) + self.assertTrue(self_link is not None) + self.assertTrue(edit_link is not None) etag = posted.get_attributes('etag')[0].value - self.assert_(etag is not None) - self.assert_(len(etag) > 0) + self.assertTrue(etag is not None) + self.assertTrue(len(etag) > 0) # Delete the test contact. http_request = atom.http_core.HttpRequest() @@ -250,14 +250,14 @@ # Create the test contact. posted = self.client.post(entry, 'https://www.google.com/m8/feeds/contacts/default/full') - self.assert_(isinstance(posted, gdata.data.GDEntry)) + self.assertTrue(isinstance(posted, gdata.data.GDEntry)) self.assertEqual(posted.get_elements('title')[0].text, 'Test') self.assertEqual(posted.get_elements('email')[0].get_attributes( 'address')[0].value, 'test@example.com') posted.get_elements('title')[0].text = 'Doug' edited = self.client.update(posted) - self.assert_(isinstance(edited, gdata.data.GDEntry)) + self.assertTrue(isinstance(edited, gdata.data.GDEntry)) self.assertEqual(edited.get_elements('title')[0].text, 'Doug') self.assertEqual(edited.get_elements('email')[0].get_attributes( 'address')[0].value, 'test@example.com') @@ -266,10 +266,10 @@ self.client.delete(edited) def notest_crud_over_https_proxy(self): - import urllib + import urllib.request, urllib.parse, urllib.error PROXY_ADDR = '98.192.125.23' try: - response = urllib.urlopen('http://' + PROXY_ADDR) + response = urllib.request.urlopen('http://' + PROXY_ADDR) except IOError: return # Only bother running the test if the proxy is up --- ./tests/gdata_tests/health_test.py (original) +++ ./tests/gdata_tests/health_test.py (refactored) @@ -33,8 +33,8 @@ def testToAndFromStringWithData(self): entry = gdata.health.ProfileEntryFromString(str(self.profile_entry)) - self.assert_(isinstance(entry, gdata.health.ProfileEntry)) - self.assert_(isinstance(entry.ccr, gdata.health.Ccr)) + self.assertTrue(isinstance(entry, gdata.health.ProfileEntry)) + self.assertTrue(isinstance(entry.ccr, gdata.heaRefactoringTool: Refactored ./tests/gdata_tests/health/service_test.py lth.Ccr)) self.assertEqual(len(entry.ccr.GetMedications()), 3) self.assertEqual(len(entry.ccr.GetImmunizations()), 1) self.assertEqual(len(entry.ccr.GetAlerts()), 2) @@ -85,7 +85,7 @@ test_data.HEALTH_PROFILE_LIST_ENTRY) def testToAndFromString(self): - self.assert_(isinstance(self.entry, gdata.health.ProfileListEntry)) + self.assertTrue(isinstance(self.entry, gdata.health.ProfileListEntry)) self.assertEqual(self.entry.GetProfileId(), 'vndCn5sdfwdEIY') self.assertEqual(self.entry.GetProfileName(), 'profile name') @@ -97,16 +97,16 @@ test_data.HEALTH_PROFILE_FEED) def testToAndFromString(self): - self.assert_(len(self.feed.entry) == 15) + self.assertTrue(len(self.feed.entry) == 15) for an_entry in self.feed.entry: - self.assert_(isinstance(an_entry, gdata.health.ProfileEntry)) + self.assertTrue(isinstance(an_entry, gdata.health.ProfileEntry)) new_profile_feed = gdata.health.ProfileFeedFromString(str(self.feed)) for an_entry in new_profile_feed.entry: - self.assert_(isinstance(an_entry, gdata.health.ProfileEntry)) + self.assertTrue(isinstance(an_entry, gdata.health.ProfileEntry)) def testConvertActualData(self): for an_entry in self.feed.entry: - self.assert_(an_entry.ccr is not None) + self.assertTrue(an_entry.ccr is not None) class HealthProfileQueryTest(unittest.TestCase): --- ./tests/gdata_tests/health/service_test.py (original) +++ ./tests/gdata_tests/health/service_test.py (refactored) @@ -33,14 +33,14 @@ self.profile_list_feed = self.health.GetProfileListFeed() def testGetProfileListFeed(self): - self.assert_(isinstance(self.profile_list_feed, + self.assertTrue(isinstance(self.profile_list_feed, gdata.health.ProfileListFeed)) self.assertEqual(self.profile_list_feed.id.text, 'https://www.google.com/health/feeds/profile/list') first_entry = self.profile_list_feed.entry[0] - self.assert_(isinstance(first_entry, gdata.health.ProfileListEntry)) - self.assert_(first_entry.GetProfileId() is not None) - self.assert_(first_entry.GetProfileName() is not None) + self.assertTrue(isinstance(first_entry, gdata.health.ProfileListEntry)) + self.assertTrue(first_entry.GetProfileId() is not None) + self.assertTrue(first_entry.GetProfileName() is not None) query = gdata.health.service.HealthProfileListQuery() profile_list = self.health.GetProfileListFeed(query) @@ -58,14 +58,14 @@ self.profile_list_feed = self.h9.GetProfileListFeed() def testGetProfileListFeed(self): - self.assert_(isinstance(self.profile_list_feed, + self.assertTrue(isinstance(self.profile_list_feed, gdata.health.ProfileListFeed)) self.assertEqual(self.profile_list_feed.id.text, 'https://www.google.com/h9/feeds/profile/list') first_entry = self.profile_list_feed.entry[0] - self.assert_(isinstance(first_entry, gdata.health.ProfileListEntry)) - self.assert_(first_entry.GetProfileId() is not None) - self.assert_(first_entry.GetProfileName() is not None) + self.assertTrue(isinstance(first_entry, gdata.health.ProfileListEntry)) + self.assertTrue(first_entry.GetProfileId() is not None) + self.assertTrue(first_entry.GetProfileName() is not None) query = gdata.health.service.HealthProfileListQuery() profile_list = self.h9.GetProfileListFeed(query) @@ -85,15 +85,15 @@ def testGetProfileFeed(self): feed = self.health.GetProfileFeed(profile_id=self.profile_id) - self.assert_(isinstance(feed, gdata.health.ProfileFeed)) - self.assert_(isinstance(feed.entry[0].ccr, gdata.health.Ccr)) + self.assertTrue(isinstance(feed, gdata.health.ProfileFeed)) + self.assertTrue(isinstance(feed.entry[0].ccr, gdata.health.Ccr)) def testGetProfileFeedByQuery(self): query = gdata.health.service.HealthProfileQuery( projection='ui', profile_id=self.profile_id) feed = self.health.GetProfileFeed(query=query) - self.assertRefactoringTool: Refactored ./tests/gdata_tests/gauth_test.py _(isinstance(feed, gdata.health.ProfileFeed)) - self.assert_(feed.entry[0].ccr is not None) + self.assertTrue(isinstance(feed, gdata.health.ProfileFeed)) + self.assertTrue(feed.entry[0].ccr is not None) def testGetProfileDigestFeed(self): query = gdata.health.service.HealthProfileQuery( @@ -109,11 +109,11 @@ feed = self.health.GetProfileFeed(query=query) self.assertEqual(len(feed.entry), 1) if feed.entry[0].ccr.GetMedications() is not None: - self.assert_(feed.entry[0].ccr.GetMedications()[0] is not None) - self.assert_(feed.entry[0].ccr.GetConditions()[0] is not None) - self.assert_(feed.entry[0].ccr.GetAllergies() is None) - self.assert_(feed.entry[0].ccr.GetAlerts() is None) - self.assert_(feed.entry[0].ccr.GetResults() is None) + self.assertTrue(feed.entry[0].ccr.GetMedications()[0] is not None) + self.assertTrue(feed.entry[0].ccr.GetConditions()[0] is not None) + self.assertTrue(feed.entry[0].ccr.GetAllergies() is None) + self.assertTrue(feed.entry[0].ccr.GetAlerts() is None) + self.assertTrue(feed.entry[0].ccr.GetResults() is None) class H9QueryProfileTest(unittest.TestCase): @@ -126,15 +126,15 @@ def testGetProfileFeed(self): feed = self.h9.GetProfileFeed(profile_id=self.profile_id) - self.assert_(isinstance(feed, gdata.health.ProfileFeed)) - self.assert_(feed.entry[0].ccr is not None) + self.assertTrue(isinstance(feed, gdata.health.ProfileFeed)) + self.assertTrue(feed.entry[0].ccr is not None) def testGetProfileFeedByQuery(self): query = gdata.health.service.HealthProfileQuery( service='h9', projection='ui', profile_id=self.profile_id) feed = self.h9.GetProfileFeed(query=query) - self.assert_(isinstance(feed, gdata.health.ProfileFeed)) - self.assert_(feed.entry[0].ccr is not None) + self.assertTrue(isinstance(feed, gdata.health.ProfileFeed)) + self.assertTrue(feed.entry[0].ccr is not None) class HealthNoticeTest(unittest.TestCase): @@ -190,6 +190,6 @@ if __name__ == '__main__': print ('Health API Tests\nNOTE: Please run these tests only with a test ' 'account. The tests may delete or update your data.') - username = raw_input('Please enter your username: ') + username = input('Please enter your username: ') password = getpass.getpass() unittest.main() --- ./tests/gdata_tests/gauth_test.py (original) +++ ./tests/gdata_tests/gauth_test.py (refactored) @@ -54,7 +54,7 @@ def test_generate_request_url(self): url = gdata.gauth.generate_auth_sub_url('http://example.com', ['http://example.net/scope1']) - self.assert_(isinstance(url, atom.http_core.Uri)) + self.assertTrue(isinstance(url, atom.http_core.Uri)) self.assertEqual(url.query['secure'], '0') self.assertEqual(url.query['session'], '1') self.assertEqual(url.query['scope'], 'http://example.net/scope1') @@ -86,7 +86,7 @@ def test_create_and_upgrade_tokens(self): token = gdata.gauth.AuthSubToken.from_url( 'http://example.com/?token=123abc') - self.assert_(isinstance(token, gdata.gauth.AuthSubToken)) + self.assertTrue(isinstance(token, gdata.gauth.AuthSubToken)) self.assertEqual(token.token_string, '123abc') self.assertEqual(token.scopes, []) token._upgrade_token('Token=456def') @@ -123,19 +123,19 @@ token = gdata.gauth.ClientLoginToken('test|key') copy = gdata.gauth.token_from_blob(gdata.gauth.token_to_blob(token)) self.assertEqual(token.token_string, copy.token_string) - self.assert_(isinstance(copy, gdata.gauth.ClientLoginToken)) + self.assertTrue(isinstance(copy, gdata.gauth.ClientLoginToken)) def test_authsub_conversion(self): token = gdata.gauth.AuthSubToken('test|key') copy = gdata.gauth.token_from_blob(gdata.gauth.token_to_blob(token)) self.assertEqual(token.token_string, copy.token_string) - self.assert_(isinstance(copy, gdata.gauth.AuthSubToken)) + self.assertTrue(isinstance(copy, gdata.gauth.AuthSubToken)) scopes = ['http://example.com', 'http://other||test', 'thir|d'] token = gdata.gauth.AuthSubToken('key-=', scopes) copy = gdata.gauth.token_from_blob(gdata.gauth.token_to_blob(token)) self.assertEqual(token.token_string, copy.token_string) - self.assert_(isinstance(copy, gdata.gauth.AuthSubToken)) + self.assertTrue(isinstance(copy, gdata.gauth.AuthSubToken)) self.assertEqual(token.scopes, scopes) def test_join_and_split(self): @@ -146,8 +146,8 @@ self.assertEqual(token_type, '1x') self.assertEqual(a, 'test|string') self.assertEqual(b, '%x%') - self.assert_(c is None) - self.assert_(d is None) + self.assertTrue(c is None) + self.assertTrue(d is None) def test_secure_authsub_conversion(self): token = gdata.gauth.SecureAuthSubToken( @@ -189,8 +189,8 @@ self.assertEqual( blob, '1s|||http%3A%2F%2Fexample.net|http%3A%2F%2Fgoogle.com') copy = gdata.gauth.token_from_blob(blob) - self.assert_(copy.token_string is None) - self.assert_(copy.rsa_private_key is None) + self.assertTrue(copy.token_string is None) + self.assertTrue(copy.rsa_private_key is None) self.assertEqual(copy.scopes, ['http://example.net', 'http://google.com']) def test_oauth_rsa_conversion(self): @@ -203,13 +203,13 @@ blob, '1r|consumerKey|myRsa|t|secret|2|http%3A%2F%2Fexample.com' '%2Fnext|verifier') copy = gdata.gauth.token_from_blob(blob) - self.assert_(isinstance(copy, gdata.gauth.OAuthRsaToken)) + self.assertTrue(isinstance(copy, gdata.gauth.OAuthRsaToken)) self.assertEqual(copy.consumer_key, token.consumer_key) self.assertEqual(copy.rsa_private_key, token.rsa_private_key) self.assertEqual(copy.token, token.token) self.assertEqual(copy.token_secret, token.token_secret) self.assertEqual(copy.auth_state, token.auth_state) - self.assertEqual(copy.next, token.next) + self.assertEqual(copy.__next__, token.__next__) self.assertEqual(copy.verifier, token.verifier) token = gdata.gauth.OAuthRsaToken( @@ -217,17 +217,17 @@ blob = gdata.gauth.token_to_blob(token) self.assertEqual(blob, '1r||myRsa|t|secret|0||') copy = gdata.gauth.token_from_blob(blob) - self.assert_(isinstance(copy, gdata.gauth.OAuthRsaToken)) - self.assert_(copy.consumer_key != token.consumer_key) - self.assert_(copy.consumer_key is None) + self.assertTrue(isinstance(copy, gdata.gauth.OAuthRsaToken)) + self.assertTrue(copy.consumer_key != token.consumer_key) + self.assertTrue(copy.consumer_key is None) self.assertEqual(copy.rsa_private_key, token.rsa_private_key) self.assertEqual(copy.token, token.token) self.assertEqual(copy.token_secret, token.token_secret) self.assertEqual(copy.auth_state, token.auth_state) - self.assertEqual(copy.next, token.next) - self.assert_(copy.next is None) + self.assertEqual(copy.__next__, token.__next__) + self.assertTrue(copy.__next__ is None) self.assertEqual(copy.verifier, token.verifier) - self.assert_(copy.verifier is None) + self.assertTrue(copy.verifier is None) token = gdata.gauth.OAuthRsaToken( rsa_private_key='myRsa', token='t', token_secret='secret', @@ -236,13 +236,13 @@ self.assertEqual(blob, '1r||myRsa|t|secret|3||v') copy = gdata.gauth.token_from_blob(blob) self.assertEqual(copy.consumer_key, token.consumer_key) - self.assert_(copy.consumer_key is None) + self.assertTrue(copy.consumer_key is None) self.assertEqual(copy.rsa_private_key, token.rsa_private_key) self.assertEqual(copy.token, token.token) self.assertEqual(copy.token_secret, token.token_secret) self.assertEqual(copy.auth_state, token.auth_state) - self.assertEqual(copy.next, token.next) - self.assert_(copy.next is None) + self.assertEqual(copy.__next__, token.__next__) + self.assertTrue(copy.__next__ is None) self.assertEqual(copy.verifier, token.verifier) def test_oauth_hmac_conversion(self): @@ -254,13 +254,13 @@ blob, '1h|consumerKey|consumerSecret|t|secret|1|http%3A%2F%2F' 'example.com%2Fnext|verifier') copy = gdata.gauth.token_from_blob(blob) - self.assert_(isinstance(copy, gdata.gauth.OAuthHmacToken)) + self.assertTrue(isinstance(copy, gdata.gauth.OAuthHmacToken)) self.assertEqual(copy.consumer_key, token.consumer_key) self.assertEqual(copy.consumer_secret, token.consumer_secret) self.assertEqual(copy.token, token.token) self.assertEqual(copy.token_secret, token.token_secret) self.assertEqual(copy.auth_state, token.auth_state) - self.assertEqual(copy.next, token.next) + self.assertEqual(copy.__next__, token.__next__) self.assertEqual(copy.verifier, token.verifier) token = gdata.gauth.OAuthHmacToken( @@ -269,15 +269,15 @@ blob = gdata.gauth.token_to_blob(token) self.assertEqual(blob, '1h||c%2Cs|t|secret|7||v') copy = gdata.gauth.token_from_blob(blob) - self.assert_(isinstance(copy, gdata.gauth.OAuthHmacToken)) + self.assertTrue(isinstance(copy, gdata.gauth.OAuthHmacToken)) self.assertEqual(copy.consumer_key, token.consumer_key) - self.assert_(copy.consumer_key is None) + self.assertTrue(copy.consumer_key is None) self.assertEqual(copy.consumer_secret, token.consumer_secret) self.assertEqual(copy.token, token.token) self.assertEqual(copy.token_secret, token.token_secret) self.assertEqual(copy.auth_state, token.auth_state) - self.assertEqual(copy.next, token.next) - self.assert_(copy.next is None) + self.assertEqual(copy.__next__, token.__next__) + self.assertTrue(copy.__next__ is None) self.assertEqual(copy.verifier, token.verifier) def test_oauth2_conversion(self): @@ -293,7 +293,7 @@ 'o%2Foauth2%2Fauth|https%3A%2F%2Faccounts.google.com%2Fo%2Foauth2' '%2Ftoken|accessToken|refreshToken') copy = gdata.gauth.token_from_blob(blob) - self.assert_(isinstance(copy, gdata.gauth.OAuth2Token)) + self.assertTrue(isinstance(copy, gdata.gauth.OAuth2Token)) self.assertEqual(copy.client_id, token.client_id) self.assertEqual(copy.client_secret, token.client_secret) @@ -316,16 +316,16 @@ 'o%2Foauth2%2Fauth|https%3A%2F%2Faccounts.google.com%2Fo%2Foauth2' '%2Ftoken||') copy = gdata.gauth.token_from_blob(blob) - self.assert_(isinstance(copy, gdata.gauth.OAuth2Token)) + self.assertTrue(isinstance(copy, gdata.gauth.OAuth2Token)) self.assertEqual(copy.client_id, token.client_id) self.assertEqual(copy.client_secret, token.client_secret) self.assertEqual(copy.scope, token.scope) - self.assert_(copy.user_agent is None) + self.assertTrue(copy.user_agent is None) self.assertEqual(copy.auth_uri, token.auth_uri) self.assertEqual(copy.token_uri, token.token_uri) - self.assert_(copy.access_token is None) - self.assert_(copy.refresh_token is None) + self.assertTrue(copy.access_token is None) + self.assertTrue(copy.refresh_token is None) token = gdata.gauth.OAuth2Token( 'clientId', 'clientSecret', 'https://www.google.com/calendar/feeds', @@ -338,16 +338,16 @@ 'o%2Foauth2%2Fauth|https%3A%2F%2Faccounts.google.com%2Fo%2Foauth2' '%2Ftoken||') copy = gdata.gauth.token_from_blob(blob) - self.assert_(isinstance(copy, gdata.gauth.OAuth2Token)) + self.assertTrue(isinstance(copy, gdata.gauth.OAuth2Token)) self.assertEqual(copy.client_id, token.client_id) self.assertEqual(copy.client_secret, token.client_secret) self.assertEqual(copy.scope, token.scope) - self.assert_(copy.user_agent is None) + self.assertTrue(copy.user_agent is None) self.assertEqual(copy.auth_uri, token.auth_uri) self.assertEqual(copy.token_uri, token.token_uri) - self.assert_(copy.access_token is None) - self.assert_(copy.refresh_token is None) + self.assertTrue(copy.access_token is None) + self.assertTrue(copy.refresh_token is None) def test_illegal_token_types(self): class MyToken(object): @@ -600,7 +600,7 @@ proxy_keys = ['client_id', 'client_secret', 'user_agent', 'token_uri', 'access_token', 'refresh_token', 'token_expiry', '_invalid'] for key in proxy_keys: - self.assertFalse(self.token.__dict__.has_key(key)) + self.assertFalse(key in self.token.__dict__) def test_get_proxied_values_change_credentials(self): new_value = 'NEW_VALUE' @@ -612,8 +612,8 @@ def test_get_proxied_values_change_credentials(self): # Make sure scope is not a valid attribute (ignored in this subclass) - self.assertFalse(self.token.__dict__.has_key('scope')) - self.assertFalse(self.token.__class__.__dict__.has_key('scope')) + self.assertFalse('scope' in self.token.__dict__) + self.assertFalse('scope' in self.token.__class__.__dict__) # Make sure attribute lookup fails as it should self.assertRaises(AttributeError, getattr, self.token, 'scope') self.assertRaises(AttributeError, lambda: self.token.scope) @@ -638,8 +638,8 @@ self._check_all_values() def test_set_proxied_values_nonprotected_attribute(self): - self.assertFalse(self.token.__dict__.has_key('scope')) - self.assertFalse(self.token.__class__.__dict__.has_key('scope')) + self.assertFalse('scope' in self.token.__dict__) + self.assertFalse('scope' in self.token.__class__.__dict__) self.token.scope = 'value' self.assertEqual(self.token.scope, 'value') self.assertFalse(hasattr(self.credentials, 'scope')) @@ -663,21 +663,21 @@ def test_generate_auth_header(self): header = gdata.gauth.generate_auth_header( 'consumerkey', 1234567890, 'mynonce', 'unknown_sig_type', 'sig') - self.assert_(header.startswith('OAuth')) - self.assert_(header.find('oauth_nonce="mynonce"') > -1) - self.assert_(header.find('oauth_timestamp="1234567890"') > -1) - self.assert_(header.find('oauth_consumer_key="consumerkey"') > -1) - self.assert_( + self.assertTrue(header.startswith('OAuth')) + self.assertTrue(header.find('oauth_nonce="mynonce"') > -1) + self.assertTrue(header.find('oauth_timestamp="1234567890"') > -1) + self.assertTrue(header.find('oauth_consumer_key="consumerkey"') > -1) + self.assertTrue( header.find('oauth_signature_method="unknown_sig_type"') > -1) - self.assert_(header.find('oauth_version="1.0"') > -1) - self.assert_(header.find('oauth_signature="sig"') > -1) + self.assertTrue(header.find('oauth_version="1.0"') > -1) + self.assertTrue(header.find('oauth_signature="sig"') > -1) header = gdata.gauth.generate_auth_header( 'consumer/key', 1234567890, 'ab%&33', '', 'ab/+-_=') - self.assert_(header.find('oauth_nonce="ab%25%2633"') > -1) - self.assert_(header.find('oauth_consumer_key="consumer%2Fkey"') > -1) - self.assert_(header.find('oauth_signature_method=""') > -1) - self.assert_(header.find('oauth_signature="ab%2F%2B-_%3D"') > -1) + self.assertTrue(header.find('oauth_nonce="ab%25%2633"') > -1) + self.assertTrue(header.find('oauth_consumer_key="consumer%2Fkey"') > -1) + self.assertTrue(header.find('oauth_signature_method=""') > -1) + self.assertTrue(header.find('oauth_signature="ab%2F%2B-_%3D"') > -1) class OAuthGetRequestToken(unittest.TestCase): @@ -689,16 +689,16 @@ 'http://www.google.com/calendar/feeds/'], consumer_secret='anonymous') request_uri = str(request.uri) - self.assert_('http%3A%2F%2Fwww.blogger.com%2Ffeeds%2F' in request_uri) - self.assert_( + self.assertTrue('http%3A%2F%2Fwww.blogger.com%2Ffeeds%2F' in request_uri) + self.assertTrue( 'http%3A%2F%2Fwww.google.com%2Fcalendar%2Ffeeds%2F' in request_uri) auth_header = request.headers['Authorization'] - self.assert_('oauth_consumer_key="anonymous"' in auth_header) - self.assert_('oauth_signature_method="HMAC-SHA1"' in auth_header) - self.assert_('oauth_version="1.0"' in auth_header) - self.assert_('oauth_signature="' in auth_header) - self.assert_('oauth_nonce="' in auth_header) - self.assert_('oauth_timestamp="' in auth_header) + self.assertTrue('oauth_consumer_key="anonymous"' in auth_header) + self.assertTrue('oauth_signature_method="HMAC-SHA1"' in auth_header) + selRefactoringTool: Refactored ./tests/gdata_tests/docs_test.py f.assertTrue('oauth_version="1.0"' in auth_header) + self.assertTrue('oauth_signature="' in auth_header) + self.assertTrue('oauth_nonce="' in auth_header) + self.assertTrue('oauth_timestamp="' in auth_header) def test_request_rsa_request_token(self): request = gdata.gauth.generate_request_for_request_token( @@ -707,16 +707,16 @@ 'http://www.google.com/calendar/feeds/'], rsa_key=PRIVATE_TEST_KEY) request_uri = str(request.uri) - self.assert_('http%3A%2F%2Fwww.blogger.com%2Ffeeds%2F' in request_uri) - self.assert_( + self.assertTrue('http%3A%2F%2Fwww.blogger.com%2Ffeeds%2F' in request_uri) + self.assertTrue( 'http%3A%2F%2Fwww.google.com%2Fcalendar%2Ffeeds%2F' in request_uri) auth_header = request.headers['Authorization'] - self.assert_('oauth_consumer_key="anonymous"' in auth_header) - self.assert_('oauth_signature_method="RSA-SHA1"' in auth_header) - self.assert_('oauth_version="1.0"' in auth_header) - self.assert_('oauth_signature="' in auth_header) - self.assert_('oauth_nonce="' in auth_header) - self.assert_('oauth_timestamp="' in auth_header) + self.assertTrue('oauth_consumer_key="anonymous"' in auth_header) + self.assertTrue('oauth_signature_method="RSA-SHA1"' in auth_header) + self.assertTrue('oauth_version="1.0"' in auth_header) + self.assertTrue('oauth_signature="' in auth_header) + self.assertTrue('oauth_nonce="' in auth_header) + self.assertTrue('oauth_timestamp="' in auth_header) def test_extract_token_from_body(self): body = ('oauth_token=4%2F5bNFM_efIu3yN-E9RrF1KfZzOAZG&oauth_token_secret=' @@ -752,9 +752,9 @@ def test_generate_authorization_url(self): url = gdata.gauth.generate_oauth_authorization_url('/+=aosdpikk') - self.assert_(str(url).startswith( + self.assertTrue(str(url).startswith( 'https://www.google.com/accounts/OAuthAuthorizeToken')) - self.assert_('oauth_token=%2F%2B%3Daosdpikk' in str(url)) + self.assertTrue('oauth_token=%2F%2B%3Daosdpikk' in str(url)) def test_extract_auth_token(self): url = ('http://www.example.com/test?oauth_token=' @@ -768,7 +768,7 @@ def test_find_all_scopes(self): count = 0 - for key, scopes in gdata.gauth.AUTH_SCOPES.iteritems(): + for key, scopes in gdata.gauth.AUTH_SCOPES.items(): count += len(scopes) self.assertEqual(count, len(gdata.gauth.find_scopes_for_services())) --- ./tests/gdata_tests/docs_test.py (original) +++ ./tests/gdata_tests/docs_test.py (refactored) @@ -53,12 +53,12 @@ test_data.DOCUMENT_LIST_FEED) def testToAndFromString(self): - self.assert_(len(self.dl_feed.entry) == 2) + self.assertTrue(len(self.dl_feed.entry) == 2) for an_entry in self.dl_feed.entry: - self.assert_(isinstance(an_entry, gdata.docs.DocumentListEntry)) + self.assertTrue(isinstance(an_entry, gdata.docs.DocumentListEntry)) new_dl_feed = gdata.docs.DocumentListFeedFromString(str(self.dl_feed)) for an_entry in new_dl_feed.entry: - self.assert_(isinstance(an_entry, gdata.docs.DocumentListEntry)) + self.assertTrue(isinstance(an_entry, gdata.docs.DocumentListEntry)) def testConvertActualData(self): for an_entry in self.dl_feed.entry: @@ -78,10 +78,10 @@ def testLinkFinderFindsLinks(self): for entry in self.dl_feed.entry: # All Document List entries should have a self link - self.assert_(entry.GetSelfLink() is not None) + self.assertTrue(entry.GetSelfLink() is not None) # All Document List entries should have an HTML link - self.assert_(entry.GetHtmlLink() is not None) - self.assert_(entry.feedLink.href is not None) + self.assertTrue(entry.GetHtmlLink() is not None) + self.assertTrue(entry.feedLink.href is not None) class DocumentListAclEntryTest(unittest.TestCase): @@ -92,18 +92,18 @@ def testToAndFromString(self): - self.assert_(isinstance(self.acl_entry, gdata.docs.DocumentListAclEntry)) - self.assert_(isinstance(self.acl_entry.role, gdata.docs.Role)) - self.assert_(isinstRefactoringTool: Refactored ./tests/gdata_tests/docs/service_test.py ance(self.acl_entry.scope, gdata.docs.Scope)) + self.assertTrue(isinstance(self.acl_entry, gdata.docs.DocumentListAclEntry)) + self.assertTrue(isinstance(self.acl_entry.role, gdata.docs.Role)) + self.assertTrue(isinstance(self.acl_entry.scope, gdata.docs.Scope)) self.assertEqual(self.acl_entry.scope.value, 'user@gmail.com') self.assertEqual(self.acl_entry.scope.type, 'user') self.assertEqual(self.acl_entry.role.value, 'writer') acl_entry_str = str(self.acl_entry) new_acl_entry = gdata.docs.DocumentListAclEntryFromString(acl_entry_str) - self.assert_(isinstance(new_acl_entry, gdata.docs.DocumentListAclEntry)) - self.assert_(isinstance(new_acl_entry.role, gdata.docs.Role)) - self.assert_(isinstance(new_acl_entry.scope, gdata.docs.Scope)) + self.assertTrue(isinstance(new_acl_entry, gdata.docs.DocumentListAclEntry)) + self.assertTrue(isinstance(new_acl_entry.role, gdata.docs.Role)) + self.assertTrue(isinstance(new_acl_entry.scope, gdata.docs.Scope)) self.assertEqual(new_acl_entry.scope.value, self.acl_entry.scope.value) self.assertEqual(new_acl_entry.scope.type, self.acl_entry.scope.type) self.assertEqual(new_acl_entry.role.value, self.acl_entry.role.value) @@ -115,9 +115,9 @@ acl_entry = gdata.docs.DocumentListAclEntry(category=[cat]) acl_entry.scope = gdata.docs.Scope(value='user@gmail.com', type='user') acl_entry.role = gdata.docs.Role(value='writer') - self.assert_(isinstance(acl_entry, gdata.docs.DocumentListAclEntry)) - self.assert_(isinstance(acl_entry.role, gdata.docs.Role)) - self.assert_(isinstance(acl_entry.scope, gdata.docs.Scope)) + self.assertTrue(isinstance(acl_entry, gdata.docs.DocumentListAclEntry)) + self.assertTrue(isinstance(acl_entry.role, gdata.docs.Role)) + self.assertTrue(isinstance(acl_entry.scope, gdata.docs.Scope)) self.assertEqual(acl_entry.scope.value, 'user@gmail.com') self.assertEqual(acl_entry.scope.type, 'user') self.assertEqual(acl_entry.role.value, 'writer') @@ -130,29 +130,29 @@ def testToAndFromString(self): for entry in self.feed.entry: - self.assert_(isinstance(entry, gdata.docs.DocumentListAclEntry)) + self.assertTrue(isinstance(entry, gdata.docs.DocumentListAclEntry)) feed = gdata.docs.DocumentListAclFeedFromString(str(self.feed)) for entry in feed.entry: - self.assert_(isinstance(entry, gdata.docs.DocumentListAclEntry)) + self.assertTrue(isinstance(entry, gdata.docs.DocumentListAclEntry)) def testConvertActualData(self): entries = self.feed.entry - self.assert_(len(entries) == 2) + self.assertTrue(len(entries) == 2) self.assertEqual(entries[0].title.text, 'Document Permission - user@gmail.com') self.assertEqual(entries[0].role.value, 'owner') self.assertEqual(entries[0].scope.type, 'user') self.assertEqual(entries[0].scope.value, 'user@gmail.com') - self.assert_(entries[0].GetSelfLink() is not None) - self.assert_(entries[0].GetEditLink() is not None) + self.assertTrue(entries[0].GetSelfLink() is not None) + self.assertTrue(entries[0].GetEditLink() is not None) self.assertEqual(entries[1].title.text, 'Document Permission - user2@google.com') self.assertEqual(entries[1].role.value, 'writer') self.assertEqual(entries[1].scope.type, 'domain') self.assertEqual(entries[1].scope.value, 'google.com') - self.assert_(entries[1].GetSelfLink() is not None) - self.assert_(entries[1].GetEditLink() is not None) + self.assertTrue(entries[1].GetSelfLink() is not None) + self.assertTrue(entries[1].GetEditLink() is not None) if __name__ == '__main__': unittest.main() --- ./tests/gdata_tests/docs/service_test.py (original) +++ ./tests/gdata_tests/docs/service_test.py (refactored) @@ -20,7 +20,7 @@ import getpass import os import re -import StringIO +import io import time import unittest @@ -55,12 +55,12 @@ self.feed = self.client.GetDocumentListFeed() def testGetDocumentsListFeed(self): - self.assert_(isinstance(self.feed, gdata.docs.DocumentListFeed)) + self.assertTrue(isinstance(self.feed, gdata.docs.DocumentListFeed)) uri = 'http://docs.google.com/feeds/documents/private/full/?max-results=1' # Query using GetDocumentListFeed() feed = self.client.GetDocumentListFeed(uri) - self.assert_(isinstance(feed, gdata.docs.DocumentListFeed)) + self.assertTrue(isinstance(feed, gdata.docs.DocumentListFeed)) self.assertEqual(len(feed.entry), 1) self.assertEqual(self.feed.entry[0].id.text, feed.entry[0].id.text) self.assertEqual(self.feed.entry[0].title.text, feed.entry[0].title.text) @@ -74,13 +74,13 @@ def testGetDocumentsListEntry(self): self_link = self.feed.entry[0].GetSelfLink().href entry = self.client.GetDocumentListEntry(self_link) - self.assert_(isinstance(entry, gdata.docs.DocumentListEntry)) + self.assertTrue(isinstance(entry, gdata.docs.DocumentListEntry)) self.assertEqual(self.feed.entry[0].id.text, entry.id.text) self.assertEqual(self.feed.entry[0].title.text, entry.title.text) - self.assert_(self.feed.entry[0].resourceId.text is not None) - self.assert_(self.feed.entry[0].lastModifiedBy is not None) - self.assert_(self.feed.entry[0].lastViewed is not None) + self.assertTrue(self.feed.entry[0].resourceId.text is not None) + self.assertTrue(self.feed.entry[0].lastModifiedBy is not None) + self.assertTrue(self.feed.entry[0].lastViewed is not None) def testGetDocumentsListAclFeed(self): uri = ('http://docs.google.com/feeds/documents/private/full/' @@ -88,10 +88,10 @@ feed = self.client.GetDocumentListFeed(uri) feed_link = feed.entry[0].GetAclLink().href acl_feed = self.client.GetDocumentListAclFeed(feed_link) - self.assert_(isinstance(acl_feed, gdata.docs.DocumentListAclFeed)) - self.assert_(isinstance(acl_feed.entry[0], gdata.docs.DocumentListAclEntry)) - self.assert_(acl_feed.entry[0].scope is not None) - self.assert_(acl_feed.entry[0].role is not None) + self.assertTrue(isinstance(acl_feed, gdata.docs.DocumentListAclFeed)) + self.assertTrue(isinstance(acl_feed.entry[0], gdata.docs.DocumentListAclEntry)) + self.assertTrue(acl_feed.entry[0].scope is not None) + self.assertTrue(acl_feed.entry[0].role is not None) class DocumentListAclTest(DocumentsListServiceTest): @@ -115,7 +115,7 @@ gdata.docs.DocumentListAclEntry(scope=scope, role=role), self.feed.entry[0].GetAclLink().href, converter=gdata.docs.DocumentListAclEntryFromString) - self.assert_(isinstance(acl_entry, gdata.docs.DocumentListAclEntry)) + self.assertTrue(isinstance(acl_entry, gdata.docs.DocumentListAclEntry)) self.assertEqual(acl_entry.scope.value, self.EMAIL) self.assertEqual(acl_entry.scope.type, self.SCOPE_TYPE) self.assertEqual(acl_entry.role.value, self.ROLE_VALUE) @@ -139,7 +139,7 @@ acl_feed = self.client.GetDocumentListAclFeed( self.feed.entry[0].GetAclLink().href) for acl_entry in acl_feed.entry: - self.assert_(acl_entry.scope.value != self.EMAIL) + self.assertTrue(acl_entry.scope.value != self.EMAIL) class DocumentListCreateAndDeleteTest(DocumentsListServiceTest): @@ -253,7 +253,7 @@ for category in moved_entry.category: starts_with_folder__prefix = category.scheme.startswith( gdata.docs.service.FOLDERS_SCHEME_PREFIX) - self.assert_(not starts_with_folder__prefix) + self.assertTrue(not starts_with_folder__prefix) created_entry = self.client.Get(created_entry.GetSelfLink().href) self.editClient.Delete(created_entry.GetEditLink().href) @@ -269,7 +269,7 @@ if category.term == dest_folder_name: folder_was_moved = True break - self.assert_(folder_was_moved) + self.assertTrue(folder_was_moved) #cleanup dest_folder = self.client.Get(dest_folder.GetSelfLink().href) @@ -284,7 +284,7 @@ entry = self.client.Upload(ms, 'test doc') self.assertEqual(entry.title.text, 'test doc') self.assertEqual(entry.category[0].label, 'document') -RefactoringTool: Refactored ./tests/gdata_tests/docs/live_client_test.py self.assert_(isinstance(entry, gdata.docs.DocumentListEntry)) + self.assertTrue(isinstance(entry, gdata.docs.DocumentListEntry)) self.editClient.Delete(entry.GetEditLink().href) def testUploadAndDeletePresentation(self): @@ -294,17 +294,17 @@ self.assertEqual(entry.title.text, 'test preso') self.assertEqual(entry.category[0].label, 'viewed') self.assertEqual(entry.category[1].label, 'presentation') - self.assert_(isinstance(entry, gdata.docs.DocumentListEntry)) + self.assertTrue(isinstance(entry, gdata.docs.DocumentListEntry)) self.editClient.Delete(entry.GetEditLink().href) def testUploadAndDeleteSpreadsheet(self): ms = gdata.MediaSource(file_path='test.csv', content_type='text/csv') entry = self.client.Upload(ms, 'test spreadsheet') - self.assert_(entry.title.text == 'test spreadsheet') + self.assertTrue(entry.title.text == 'test spreadsheet') self.assertEqual(entry.category[0].label, 'viewed') self.assertEqual(entry.category[1].label, 'spreadsheet') - self.assert_(isinstance(entry, gdata.docs.DocumentListEntry)) + self.assertTrue(isinstance(entry, gdata.docs.DocumentListEntry)) self.editClient.Delete(entry.GetEditLink().href) @@ -341,7 +341,7 @@ # Append content to document data = 'data to append' - ms = gdata.MediaSource(file_handle=StringIO.StringIO(data), + ms = gdata.MediaSource(file_handle=io.StringIO(data), content_type='text/plain', content_length=len(data)) uri = updated_entry.GetEditMediaLink().href + '?append=true' @@ -360,8 +360,8 @@ './downloadedTest.txt', './downloadedTest.zip'] for path in file_paths: self.client.Export(feed.entry[0], path) - self.assert_(os.path.exists(path)) - self.assert_(os.path.getsize(path)) + self.assertTrue(os.path.exists(path)) + self.assertTrue(os.path.getsize(path)) os.remove(path) def testExportPresentation(self): @@ -372,8 +372,8 @@ './downloadedTest.swf', './downloadedTest.txt'] for path in file_paths: self.client.Export(feed.entry[0].resourceId.text, path) - self.assert_(os.path.exists(path)) - self.assert_(os.path.getsize(path)) + self.assertTrue(os.path.exists(path)) + self.assertTrue(os.path.getsize(path)) os.remove(path) def testExportSpreadsheet(self): @@ -387,8 +387,8 @@ self.client.SetClientLoginToken(self.spreadsheets.GetClientLoginToken()) for path in file_paths: self.client.Export(feed.entry[0], path) - self.assert_(os.path.exists(path)) - self.assert_(os.path.getsize(path) > 0) + self.assertTrue(os.path.exists(path)) + self.assertTrue(os.path.getsize(path) > 0) os.remove(path) self.client.SetClientLoginToken(docs_token) @@ -397,15 +397,15 @@ exception_raised = False try: self.client.Export('non_existent_doc', path) - except Exception, e: # expected + except Exception as e: # expected exception_raised = True - self.assert_(exception_raised) - self.assert_(not os.path.exists(path)) + self.assertTrue(exception_raised) + self.assertTrue(not os.path.exists(path)) if __name__ == '__main__': print ('DocList API Tests\nNOTE: Please run these tests only with a test ' 'account. The tests may delete or update your data.') - username = raw_input('Please enter your username: ') + username = input('Please enter your username: ') password = getpass.getpass() if client.GetClientLoginToken() is None: client.ClientLogin(username, password, --- ./tests/gdata_tests/docs/live_client_test.py (original) +++ ./tests/gdata_tests/docs/live_client_test.py (refactored) @@ -168,43 +168,43 @@ def testGetAllResources(self): results = self.client.GetAllResources( '/feeds/default/private/full?showfolders=true') - self.assert_(all(isinstance(item, gdata.docs.data.Resource) \ + self.assertTrue(all(isinstance(item, gdata.docs.data.Resource) \ for item in results)) self.assertEqual(len(results), 1) def testGetResources(self): feed = self.client.GetResources( '/feeds/default/private/full?showfolders=true', limit=1) - self.assert_(isinstance(feed, gdata.docs.data.ResourceFeed)) + self.assertTrue(isinstance(feed, gdata.docs.data.ResourceFeed)) self.assertEqual(len(feed.entry), 1) def testGetResource(self): entry = self.client.GetResource(self.resource) - self.assert_(isinstance(entry, gdata.docs.data.Resource)) - self.assert_(entry.id.text is not None) - self.assert_(entry.title.text is not None) - self.assert_(entry.resource_id.text is not None) - self.assert_(entry.title.text is not None) + self.assertTrue(isinstance(entry, gdata.docs.data.Resource)) + self.assertTrue(entry.id.text is not None) + self.assertTrue(entry.title.text is not None) + self.assertTrue(entry.resource_id.text is not None) + self.assertTrue(entry.title.text is not None) entry = self.client.GetResourceById(self.resource.resource_id.text) - self.assert_(isinstance(entry, gdata.docs.data.Resource)) - self.assert_(entry.id.text is not None) - self.assert_(entry.title.text is not None) - self.assert_(entry.resource_id.text is not None) - self.assert_(entry.title.text is not None) + self.assertTrue(isinstance(entry, gdata.docs.data.Resource)) + self.assertTrue(entry.id.text is not None) + self.assertTrue(entry.title.text is not None) + self.assertTrue(entry.resource_id.text is not None) + self.assertTrue(entry.title.text is not None) entry = self.client.GetResourceById( self.resource.resource_id.text.split(':')[1]) - self.assert_(isinstance(entry, gdata.docs.data.Resource)) - self.assert_(entry.id.text is not None) - self.assert_(entry.title.text is not None) - self.assert_(entry.resource_id.text is not None) - self.assert_(entry.title.text is not None) + self.assertTrue(isinstance(entry, gdata.docs.data.Resource)) + self.assertTrue(entry.id.text is not None) + self.assertTrue(entry.title.text is not None) + self.assertTrue(entry.resource_id.text is not None) + self.assertTrue(entry.title.text is not None) entry = self.client.GetResourceBySelfLink( self.resource.GetSelfLink().href) - self.assert_(isinstance(entry, gdata.docs.data.Resource)) - self.assert_(entry.id.text is not None) - self.assert_(entry.title.text is not None) - self.assert_(entry.resource_id.text is not None) - self.assert_(entry.title.text is not None) + self.assertTrue(isinstance(entry, gdata.docs.data.Resource)) + self.assertTrue(entry.id.text is not None) + self.assertTrue(entry.title.text is not None) + self.assertTrue(entry.resource_id.text is not None) + self.assertTrue(entry.title.text is not None) def testMoveResource(self): entry = gdata.docs.data.Resource( @@ -290,17 +290,17 @@ class AclTest(DocsTestCase): def testGetAcl(self): acl_feed = self.client.GetResourceAcl(self.resource) - self.assert_(isinstance(acl_feed, gdata.docs.data.AclFeed)) + self.assertTrue(isinstance(acl_feed, gdata.docs.data.AclFeed)) self.assertEqual(len(acl_feed.entry), 1) - self.assert_(isinstance(acl_feed.entry[0], gdata.docs.data.AclEntry)) - self.assert_(acl_feed.entry[0].scope is not None) - self.assert_(acl_feed.entry[0].role is not None) + self.assertTrue(isinstance(acl_feed.entry[0], gdata.docs.data.AclEntry)) + self.assertTrue(acl_feed.entry[0].scope is not None) + self.assertTrue(acl_feed.entry[0].role is not None) def testGetAclEntry(self): acl_feed = self.client.GetResourceAcl(self.resource) acl_entry = acl_feed.entry[0] same_acl_entry = self.client.GetAclEntry(acl_entry) - self.assert_(isinstance(same_acl_entry, gdata.docs.data.AclEntry)) + self.assertTrue(isinstance(same_acl_entry, gdata.docs.data.AclEntry)) self.assertEqual(acl_entry.GetSelfLink().href, same_acl_entry.GetSelfLink().href) self.assertEqual(acl_entry.title.text, same_acl_entry.title.text) @@ -316,9 +316,9 @@ self.assertEqual(acl_entry_to_add.with_key.role.value, new_acl_entry.with_key.role.value) acl_feed = self.client.GetResourceAcl(self.resource) - self.assert_(isinstance(acl_feed, gdata.docs.data.AclFeed)) - self.assert_(isinstance(acl_feed.entry[0], gdata.docs.data.AclEntry)) - self.assert_(isinstance(acl_feed.entry[1], gdata.docs.data.AclEntry)) + self.assertTrue(isinstance(acl_feed, gdata.docs.data.AclFeed)) + self.assertTrue(isinstance(acl_feed.entry[0], gdata.docs.data.AclEntry)) + self.assertTrue(isinstance(acl_feed.entry[1], gdata.docs.data.AclEntry)) def testUpdateAclEntry(self): acl_entry_to_add = gdata.docs.data.AclEntry.GetInstance( @@ -349,17 +349,17 @@ new_acl_entry = self.client.AddAclEntry(self.resource, acl_entry_to_add) acl_feed = self.client.GetResourceAcl(self.resource) - self.assert_(isinstance(acl_feed, gdata.docs.data.AclFeed)) + self.assertTrue(isinstance(acl_feed, gdata.docs.data.AclFeed)) self.assertEqual(len(acl_feed.entry), 2) - self.assert_(isinstance(acl_feed.entry[0], gdata.docs.data.AclEntry)) - self.assert_(isinstance(acl_feed.entry[1], gdata.docs.data.AclEntry)) + self.assertTrue(isinstance(acl_feed.entry[0], gdata.docs.data.AclEntry)) + self.assertTrue(isinstance(acl_feed.entry[1], gdata.docs.data.AclEntry)) self.client.DeleteAclEntry(new_acl_entry) acl_feed = self.client.GetResourceAcl(self.resource) - self.assert_(isinstance(acl_feed, gdata.docs.data.AclFeed)) + self.assertTrue(isinstance(acl_feed, gdata.docs.data.AclFeed)) self.assertEqual(len(acl_feed.entry), 1) - self.assert_(isinstance(acl_feed.entry[0], gdata.docs.data.AclEntry)) + self.assertTrue(isinstance(acl_feed.entry[0], gdata.docs.data.AclEntry)) class RevisionsTest(DocsTestCase): @@ -367,8 +367,8 @@ # There are no revisions of collections if self.resource_type != 'collection': revisions = self.client.GetRevisions(self.resource) - self.assert_(isinstance(revisions, gdata.docs.data.RevisionFeed)) - self.assert_(isinstance(revisions.entry[0], gdata.docs.data.Revision)) + self.assertTrue(isinstance(revisions, gdata.docs.data.RevisionFeed)) + self.assertTrue(isinstance(revisions.entry[0], gdata.docs.data.Revision)) # Currently, there is a bug where new presentations have 2 revisions. if self.resource_type != 'presentation': self.assertEqual(len(revisions.entry), 1) @@ -410,14 +410,14 @@ if self.resource_type != 'collection': revisions = self.client.GetRevisions(entry) - self.assert_(isinstance(revisions, gdata.docs.data.RevisionFeed)) + self.assertTrue(isinstance(revisions, gdata.docs.data.RevisionFeed)) if self.resource_type == 'presentation': self.assertEqual(len(revisions.entry), 3) - self.assert_(isinstance(revisions.entry[2], gdata.docs.data.Revision)) + self.assertTrue(isinstance(revisions.entry[2], gdata.docs.data.Revision)) else: self.assertEqual(len(revisions.entry), 2) - self.assert_(isinstance(revisions.entry[0], gdata.docs.data.Revision)) - self.assert_(isinstance(revisions.entry[1], gdata.docs.data.Revision)) + self.assertTrue(isinstance(revisions.entry[0], gdata.docs.data.Revision)) + self.assertTrue(isinstance(revisions.entry[1], gdata.docs.data.Revision)) def testPublishRevision(self): if self.resource_type in ['file', 'pdf', 'collection']: @@ -434,7 +434,7 @@ if self.resource_type == 'presentation': revisions = self.client.GetRevisions(entry) revision = revisions.entry[2] - self.assert_(isinstance(revision, gdata.docs.data.Revision)) + self.assertTrue(isinstance(revision, gdata.docs.data.Revision)) self.assertEqual(revision.publish.value, 'true') self.assertEqual(revision.publish_auto.value, 'false') @@ -457,7 +457,7 @@ revisions.entry[1], publish_auto=True, publish_outside_domain=True) if self.resource_type ==RefactoringTool: Refactored ./tests/gdata_tests/docs/data_test.py 'spreadsheet': revision = client.GetRevisions(entry).entry[1] - self.assert_(isinstance(revision, gdata.docs.data.Revision)) + self.assertTrue(isinstance(revision, gdata.docs.data.Revision)) self.assertEqual(revision.publish.value, 'true') self.assertEqual(revision.publish_auto.value, 'true') self.assertEqual(revision.publish_outside_domain.value, 'true') @@ -486,8 +486,8 @@ revisions = self.client.GetRevisions(entry) self.assertEqual(len(revisions.entry), 2) self.client.DeleteRevision(revisions.entry[1]) - self.assert_(isinstance(revisions, gdata.docs.data.RevisionFeed)) - self.assert_(isinstance(revisions.entry[0], gdata.docs.data.Revision)) + self.assertTrue(isinstance(revisions, gdata.docs.data.RevisionFeed)) + self.assertTrue(isinstance(revisions.entry[0], gdata.docs.data.Revision)) revisions = self.client.GetRevisions(entry) self.assertEqual(len(revisions.entry), 1) @@ -498,14 +498,14 @@ # being used already has a number of changes changes = self.client.GetChanges(max_results=5) - self.assert_(isinstance(changes, gdata.docs.data.ChangeFeed)) - self.assert_(len(changes.entry) <= 5) - self.assert_(isinstance(changes.entry[0], gdata.docs.data.Change)) + self.assertTrue(isinstance(changes, gdata.docs.data.ChangeFeed)) + self.assertTrue(len(changes.entry) <= 5) + self.assertTrue(isinstance(changes.entry[0], gdata.docs.data.Change)) self._update() changes = self.client.GetChanges(changes.entry[0].changestamp.value, 5) - self.assert_(isinstance(changes, gdata.docs.data.ChangeFeed)) - self.assert_(len(changes.entry) <= 5) - self.assert_(isinstance(changes.entry[0], gdata.docs.data.Change)) + self.assertTrue(isinstance(changes, gdata.docs.data.ChangeFeed)) + self.assertTrue(len(changes.entry) <= 5) + self.assertTrue(isinstance(changes.entry[0], gdata.docs.data.Change)) def testDeleteResourceCreatesNewChange(self): """Ensure that deleting a resource causes a new change entry.""" @@ -515,7 +515,7 @@ self._delete(self.resource) time.sleep(10) changes = self.client.GetChanges(max_results=1) - self.assert_(latest < changes.entry[0].changestamp.value) + self.assertTrue(latest < changes.entry[0].changestamp.value) class MetadataTest(DocsTestCase): @@ -536,7 +536,7 @@ def testMetadata(self): metadata = self.client.GetMetadata() - self.assert_(isinstance(metadata, gdata.docs.data.Metadata)) + self.assertTrue(isinstance(metadata, gdata.docs.data.Metadata)) self.assertNotEqual(int(metadata.quota_bytes_total.text), 0) self.assertEqual(int(metadata.quota_bytes_used.text), 0) self.assertEqual(int(metadata.quota_bytes_used_in_trash.text), 0) @@ -548,7 +548,7 @@ def suite(): suite = unittest.TestSuite() - for key, value in RESOURCES.iteritems(): + for key, value in RESOURCES.items(): for case in [ResourcesTest, AclTest, RevisionsTest, ChangesTest]: tests = unittest.TestLoader().loadTestsFromTestCase(case) for test in tests: --- ./tests/gdata_tests/docs/data_test.py (original) +++ ./tests/gdata_tests/docs/data_test.py (refactored) @@ -33,26 +33,26 @@ gdata.docs.data.Resource) def testToAndFromStringDocsEntry(self): - self.assert_(isinstance(self.entry, gdata.docs.data.Resource)) + self.assertTrue(isinstance(self.entry, gdata.docs.data.Resource)) self.assertEqual(self.entry.GetResourceType(), 'spreadsheet') - self.assert_(isinstance(self.entry.last_viewed, gdata.docs.data.LastViewed)) + self.assertTrue(isinstance(self.entry.last_viewed, gdata.docs.data.LastViewed)) self.assertEqual(self.entry.last_viewed.text, '2009-03-05T07:48:21.493Z') - self.assert_( + self.assertTrue( isinstance(self.entry.last_modified_by, gdata.docs.data.LastModifiedBy)) self.assertEqual( self.entry.last_modified_by.email.text, 'test.user@gmail.com') self.assertEqual(self.entry.last_modified_by.name.text, 'test.user') - self.assert_(isinstance(self.entry.resource_id, gdata.docs.data.ResourceId)) + self.assertTrue(isinstance(self.entry.resource_id, gdata.docs.data.ResourceId)) self.assertEqual(self.entry.resource_id.text, 'spreadsheet:supercalifragilisticexpealidocious') - self.assert_(isinstance(self.entry.writers_can_invite, + self.assertTrue(isinstance(self.entry.writers_can_invite, gdata.docs.data.WritersCanInvite)) self.assertEqual(self.entry.writers_can_invite.value, 'true') - self.assert_(isinstance(self.entry.quota_bytes_used, + self.assertTrue(isinstance(self.entry.quota_bytes_used, gdata.docs.data.QuotaBytesUsed)) self.assertEqual(self.entry.quota_bytes_used.text, '1000') self.assertEqual(len(self.entry.feed_link), 2) - self.assert_(isinstance(self.entry.feed_link[0], gdata.data.FeedLink)) + self.assertTrue(isinstance(self.entry.feed_link[0], gdata.data.FeedLink)) self.assertEqual( self.entry.GetAclFeedLink().href, @@ -79,30 +79,30 @@ gdata.docs.data.AclEntry) def testToAndFromString(self): - self.assert_(isinstance(self.acl_entry, gdata.docs.data.AclEntry)) - self.assert_(isinstance(self.acl_entry.role, gdata.acl.data.AclRole)) - self.assert_(isinstance(self.acl_entry.scope, gdata.acl.data.AclScope)) + self.assertTrue(isinstance(self.acl_entry, gdata.docs.data.AclEntry)) + self.assertTrue(isinstance(self.acl_entry.role, gdata.acl.data.AclRole)) + self.assertTrue(isinstance(self.acl_entry.scope, gdata.acl.data.AclScope)) self.assertEqual(self.acl_entry.scope.value, 'user@gmail.com') self.assertEqual(self.acl_entry.scope.type, 'user') self.assertEqual(self.acl_entry.role.value, 'writer') acl_entry_str = str(self.acl_entry) new_acl_entry = atom.core.parse(acl_entry_str, gdata.docs.data.AclEntry) - self.assert_(isinstance(new_acl_entry, gdata.docs.data.AclEntry)) - self.assert_(isinstance(new_acl_entry.role, gdata.acl.data.AclRole)) - self.assert_(isinstance(new_acl_entry.scope, gdata.acl.data.AclScope)) + self.assertTrue(isinstance(new_acl_entry, gdata.docs.data.AclEntry)) + self.assertTrue(isinstance(new_acl_entry.role, gdata.acl.data.AclRole)) + self.assertTrue(isinstance(new_acl_entry.scope, gdata.acl.data.AclScope)) self.assertEqual(new_acl_entry.scope.value, self.acl_entry.scope.value) self.assertEqual(new_acl_entry.scope.type, self.acl_entry.scope.type) self.assertEqual(new_acl_entry.role.value, self.acl_entry.role.value) def testToAndFromStringWithKey(self): - self.assert_(isinstance(self.acl_entry_withkey, gdata.docs.data.AclEntry)) - self.assert_(self.acl_entry_withkey.role is None) - self.assert_(isinstance(self.acl_entry_withkey.with_key, + self.assertTrue(isinstance(self.acl_entry_withkey, gdata.docs.data.AclEntry)) + self.assertTrue(self.acl_entry_withkey.role is None) + self.assertTrue(isinstance(self.acl_entry_withkey.with_key, gdata.acl.data.AclWithKey)) - self.assert_(isinstance(self.acl_entry_withkey.with_key.role, + self.assertTrue(isinstance(self.acl_entry_withkey.with_key.role, gdata.acl.data.AclRole)) - self.assert_(isinstance(self.acl_entry_withkey.scope, + self.assertTrue(isinstance(self.acl_entry_withkey.scope, gdata.acl.data.AclScope)) self.assertEqual(self.acl_entry_withkey.with_key.key, 'somekey') self.assertEqual(self.acl_entry_withkey.with_key.role.value, 'writer') @@ -112,13 +112,13 @@ acl_entry_withkey_str = str(self.acl_entry_withkey) new_acl_entry_withkey = atom.core.parse(acl_entry_withkey_str, gdata.docs.data.AclEntry) - self.assert_(isinstance(new_acl_entry_withkey, gdata.docs.data.AclEntry)) - self.assert_(new_acl_entry_withkey.role is None) - self.assert_(isinstance(new_acl_entry_withkey.with_key, + self.assertTrue(isinstance(new_acl_entry_withkey, gdata.docs.data.AclEntry)) + self.assertTrue(new_acl_entrRefactoringTool: Refactored ./tests/gdata_tests/data_test.py y_withkey.role is None) + self.assertTrue(isinstance(new_acl_entry_withkey.with_key, gdata.acl.data.AclWithKey)) - self.assert_(isinstance(new_acl_entry_withkey.with_key.role, + self.assertTrue(isinstance(new_acl_entry_withkey.with_key.role, gdata.acl.data.AclRole)) - self.assert_(isinstance(new_acl_entry_withkey.scope, + self.assertTrue(isinstance(new_acl_entry_withkey.scope, gdata.acl.data.AclScope)) self.assertEqual(new_acl_entry_withkey.with_key.key, self.acl_entry_withkey.with_key.key) @@ -136,9 +136,9 @@ acl_entry = gdata.docs.DocumentListAclEntry(category=[cat]) acl_entry.scope = gdata.docs.Scope(value='user@gmail.com', type='user') acl_entry.role = gdata.docs.Role(value='writer') - self.assert_(isinstance(acl_entry, gdata.docs.DocumentListAclEntry)) - self.assert_(isinstance(acl_entry.role, gdata.docs.Role)) - self.assert_(isinstance(acl_entry.scope, gdata.docs.Scope)) + self.assertTrue(isinstance(acl_entry, gdata.docs.DocumentListAclEntry)) + self.assertTrue(isinstance(acl_entry.role, gdata.docs.Role)) + self.assertTrue(isinstance(acl_entry.scope, gdata.docs.Scope)) self.assertEqual(acl_entry.scope.value, 'user@gmail.com') self.assertEqual(acl_entry.scope.type, 'user') self.assertEqual(acl_entry.role.value, 'writer') @@ -160,29 +160,29 @@ def testToAndFromString(self): for entry in self.feed.entry: - self.assert_(isinstance(entry, gdata.docs.data.AclEntry)) + self.assertTrue(isinstance(entry, gdata.docs.data.AclEntry)) feed = atom.core.parse(str(self.feed), gdata.docs.data.AclFeed) for entry in feed.entry: - self.assert_(isinstance(entry, gdata.docs.data.AclEntry)) + self.assertTrue(isinstance(entry, gdata.docs.data.AclEntry)) def testConvertActualData(self): entries = self.feed.entry - self.assert_(len(entries) == 2) + self.assertTrue(len(entries) == 2) self.assertEqual(entries[0].title.text, 'Document Permission - user@gmail.com') self.assertEqual(entries[0].role.value, 'owner') self.assertEqual(entries[0].scope.type, 'user') self.assertEqual(entries[0].scope.value, 'user@gmail.com') - self.assert_(entries[0].GetSelfLink() is not None) - self.assert_(entries[0].GetEditLink() is not None) + self.assertTrue(entries[0].GetSelfLink() is not None) + self.assertTrue(entries[0].GetEditLink() is not None) self.assertEqual(entries[1].title.text, 'Document Permission - user2@google.com') self.assertEqual(entries[1].role.value, 'writer') self.assertEqual(entries[1].scope.type, 'domain') self.assertEqual(entries[1].scope.value, 'google.com') - self.assert_(entries[1].GetSelfLink() is not None) - self.assert_(entries[1].GetEditLink() is not None) + self.assertTrue(entries[1].GetSelfLink() is not None) + self.assertTrue(entries[1].GetEditLink() is not None) class RevisionFeedTest(unittest.TestCase): @@ -193,15 +193,15 @@ def testToAndFromString(self): for entry in self.feed.entry: - self.assert_(isinstance(entry, gdata.docs.data.Revision)) + self.assertTrue(isinstance(entry, gdata.docs.data.Revision)) feed = atom.core.parse(str(self.feed), gdata.docs.data.RevisionFeed) for entry in feed.entry: - self.assert_(isinstance(entry, gdata.docs.data.Revision)) + self.assertTrue(isinstance(entry, gdata.docs.data.Revision)) def testConvertActualData(self): entries = self.feed.entry - self.assert_(len(entries) == 1) + self.assertTrue(len(entries) == 1) self.assertEqual(entries[0].title.text, 'Revision 2') self.assertEqual(entries[0].publish.value, 'true') self.assertEqual(entries[0].publish_auto.value, 'true') --- ./tests/gdata_tests/data_test.py (original) +++ ./tests/gdata_tests/data_test.py (refactored) @@ -86,10 +86,10 @@ def testToAndFromString(self): self.start_index.text = '1' - self.assert_(self.start_index.text == '1') + self.assertTrue(self.start_index.text == '1') new_start_index = parse(self.start_index.ToString(), gdata.data.StartIndex) - self.assert_(self.start_index.text == new_start_index.text) + self.assertTrue(self.start_index.text == new_start_index.text) class ItemsPerPageTest(unittest.TestCase): @@ -99,10 +99,10 @@ def testToAndFromString(self): self.items_per_page.text = '10' - self.assert_(self.items_per_page.text == '10') + self.assertTrue(self.items_per_page.text == '10') new_items_per_page = parse(self.items_per_page.ToString(), gdata.data.ItemsPerPage) - self.assert_(self.items_per_page.text == new_items_per_page.text) + self.assertTrue(self.items_per_page.text == new_items_per_page.text) class GDataEntryTest(unittest.TestCase): @@ -110,14 +110,14 @@ def testIdShouldBeCleaned(self): entry = parse(XML_ENTRY_1, gdata.data.GDEntry) tree = parse(XML_ENTRY_1, atom.core.XmlElement) - self.assert_(tree.get_elements('id', + self.assertTrue(tree.get_elements('id', 'http://www.w3.org/2005/Atom')[0].text != entry.get_id()) self.assertEqual(entry.get_id(), 'http://www.google.com/test/id/url') def testGeneratorShouldBeCleaned(self): feed = parse(test_data.GBASE_FEED, gdata.data.GDFeed) tree = parse(test_data.GBASE_FEED, atom.core.XmlElement) - self.assert_(tree.get_elements('generator', + self.assertTrue(tree.get_elements('generator', 'http://www.w3.org/2005/Atom')[0].text != feed.get_generator()) self.assertEqual(feed.get_generator(), 'GoogleBase') @@ -134,20 +134,20 @@ self.entry = parse(XML_ENTRY_1, gdata.data.GDEntry) def testLinkFinderGetsLicenseLink(self): - self.assertEquals(isinstance(self.entry.FindLicenseLink(), str), + self.assertEqual(isinstance(self.entry.FindLicenseLink(), str), True) - self.assertEquals(self.entry.FindLicenseLink(), + self.assertEqual(self.entry.FindLicenseLink(), 'http://creativecommons.org/licenses/by-nc/2.5/rdf') def testLinkFinderGetsAlternateLink(self): - self.assert_(isinstance(self.entry.FindAlternateLink(), str)) - self.assertEquals(self.entry.FindAlternateLink(), + self.assertTrue(isinstance(self.entry.FindAlternateLink(), str)) + self.assertEqual(self.entry.FindAlternateLink(), 'http://www.provider-host.com/123456789') def testFindAclLink(self): entry = gdata.data.GDEntry() - self.assert_(entry.get_acl_link() is None) - self.assert_(entry.find_acl_link() is None) + self.assertTrue(entry.get_acl_link() is None) + self.assertTrue(entry.find_acl_link() is None) entry.link.append(atom.data.Link( rel=gdata.data.ACL_REL, href='http://example.com/acl')) @@ -155,8 +155,8 @@ self.assertEqual(entry.find_acl_link(), 'http://example.com/acl') del entry.link[0] - self.assert_(entry.get_acl_link() is None) - self.assert_(entry.find_acl_link() is None) + self.assertTrue(entry.get_acl_link() is None) + self.assertTrue(entry.find_acl_link() is None) # We should also find an ACL link which is a feed_link. entry.feed_link = [gdata.data.FeedLink( @@ -169,10 +169,10 @@ def testCorrectConversionToElementTree(self): test_feed = parse(test_data.GBASE_FEED, gdata.data.GDFeed) - self.assert_(test_feed.total_results is not None) - self.assert_(test_feed.get_elements('totalResults', + self.assertTrue(test_feed.total_results is not None) + self.assertTrue(test_feed.get_elements('totalResults', 'http://a9.com/-/spec/opensearchrss/1.0/') is not None) - self.assert_(len(test_feed.get_elements('totalResults', + self.assertTrue(len(test_feed.get_elements('totalResults', 'http://a9.com/-/spec/opensearchrss/1.0/')) > 0) def testAllowsEmptyId(self): @@ -188,23 +188,23 @@ def testCorrectConversionFromAndToString(self): batch_entry = parse(test_data.BATCH_ENTRY, gdata.data.BatchEntry) - self.assertEquals(batch_entry.batch_id.text, 'itemB') - self.assertEquals(batch_entry.id.text, + self.assertEqual(batch_entry.batch_id.text, 'itemB') + self.assertEqual(batch_entry.id.text, 'http://www.google.com/base/feeds/items/' '2173859253842813008') - self.assertEquals(batch_entry.batch_operation.type, 'insert') - self.assertEquals(batch_entry.batch_status.code, '201') - self.assertEquals(batch_entry.batch_status.reason, 'Created') + self.assertEqual(batch_entry.batch_operation.type, 'insert') + self.assertEqual(batch_entry.batch_status.code, '201') + self.assertEqual(batch_entry.batch_status.reason, 'Created') new_entry = parse(str(batch_entry), gdata.data.BatchEntry) - self.assertEquals(batch_entry.batch_id.text, new_entry.batch_id.text) - self.assertEquals(batch_entry.id.text, new_entry.id.text) - self.assertEquals(batch_entry.batch_operation.type, + self.assertEqual(batch_entry.batch_id.text, new_entry.batch_id.text) + self.assertEqual(batch_entry.id.text, new_entry.id.text) + self.assertEqual(batch_entry.batch_operation.type, new_entry.batch_operation.type) - self.assertEquals(batch_entry.batch_status.code, + self.assertEqual(batch_entry.batch_status.code, new_entry.batch_status.code) - self.assertEquals(batch_entry.batch_status.reason, + self.assertEqual(batch_entry.batch_status.reason, new_entry.batch_status.reason) @@ -218,44 +218,44 @@ def testConvertRequestFeed(self): batch_feed = parse(test_data.BATCH_FEED_REQUEST, gdata.data.BatchFeed) - self.assertEquals(len(batch_feed.entry), 4) + self.assertEqual(len(batch_feed.entry), 4) for entry in batch_feed.entry: - self.assert_(isinstance(entry, gdata.data.BatchEntry)) - self.assertEquals(batch_feed.title.text, 'My Batch Feed') + self.assertTrue(isinstance(entry, gdata.data.BatchEntry)) + self.assertEqual(batch_feed.title.text, 'My Batch Feed') new_feed = parse(batch_feed.to_string(), gdata.data.BatchFeed) - self.assertEquals(len(new_feed.entry), 4) + self.assertEqual(len(new_feed.entry), 4) for entry in new_feed.entry: - self.assert_(isinstance(entry, gdata.data.BatchEntry)) - self.assertEquals(new_feed.title.text, 'My Batch Feed') + self.assertTrue(isinstance(entry, gdata.data.BatchEntry)) + self.assertEqual(new_feed.title.text, 'My Batch Feed') def testConvertResultFeed(self): batch_feed = parse(test_data.BATCH_FEED_RESULT, gdata.data.BatchFeed) - self.assertEquals(len(batch_feed.entry), 4) + self.assertEqual(len(batch_feed.entry), 4) for entry in batch_feed.entry: - self.assert_(isinstance(entry, gdata.data.BatchEntry)) + self.assertTrue(isinstance(entry, gdata.data.BatchEntry)) if entry.id.text == ('http://www.google.com/base/feeds/items/' '2173859253842813008'): - self.assertEquals(entry.batch_operation.type, 'insert') - self.assertEquals(entry.batch_id.text, 'itemB') - self.assertEquals(entry.batch_status.code, '201') - self.assertEquals(entry.batch_status.reason, 'Created') - self.assertEquals(batch_feed.title.text, 'My Batch') + self.assertEqual(entry.batch_operation.type, 'insert') + self.assertEqual(entry.batch_id.text, 'itemB') + self.assertEqual(entry.batch_status.code, '201') + self.assertEqual(entry.batch_status.reason, 'Created') + self.assertEqual(batch_feed.title.text, 'My Batch') new_feed = parse(str(batch_feed), gdata.data.BatchFeed) - self.assertEquals(len(new_feed.entry), 4) + self.assertEqual(len(new_feed.entry), 4) for entry in new_feed.entry: - self.assert_(isinstance(entry, gdata.data.BatchEntry)) + self.assertTrue(isinstance(entry, gdata.data.BatchEntry)) if entry.id.text == ('http://www.google.com/base/feeds/items/' '2173859253842813008'): - self.assertEquals(entry.batch_operation.type, 'insert') - self.assertEquals(entry.batch_id.text, 'itemB') - self.assertEquals(entry.batch_status.code, '201') - self.assertEquals(entry.batch_status.reason, 'Created') - self.assertEquals(new_feed.title.text, 'My Batch') + self.assertEqual(entry.batch_operation.type, 'insert') + self.assertEqual(entry.batch_id.text, 'itemB') + self.assertEqual(entry.batch_status.code, '201') + self.assertEqual(entry.batch_status.reason, 'Created') + self.assertEqual(new_feed.title.text, 'My Batch') def testAddBatchEntry(self): try: @@ -266,59 +266,59 @@ new_entry = self.batch_feed.AddBatchEntry( id_url_string='http://example.com/1') - self.assertEquals(len(self.batch_feed.entry), 1) - self.assertEquals(self.batch_feed.entry[0].get_id(), + self.assertEqual(len(self.batch_feed.entry), 1) + self.assertEqual(self.batch_feed.entry[0].get_id(), 'http://example.com/1') - self.assertEquals(self.batch_feed.entry[0].batch_id.text, '0') - self.assertEquals(new_entry.id.text, 'http://example.com/1') - self.assertEquals(new_entry.batch_id.text, '0') + self.assertEqual(self.batch_feed.entry[0].batch_id.text, '0') + self.assertEqual(new_entry.id.text, 'http://example.com/1') + self.assertEqual(new_entry.batch_id.text, '0') to_add = gdata.data.BatchEntry(id=atom.data.Id(text='originalId')) new_entry = self.batch_feed.AddBatchEntry(entry=to_add, batch_id_string='foo') - self.assertEquals(new_entry.batch_id.text, 'foo') - self.assertEquals(new_entry.id.text, 'originalId') + self.assertEqual(new_entry.batch_id.text, 'foo') + self.assertEqual(new_entry.id.text, 'originalId') to_add = gdata.data.BatchEntry(id=atom.data.Id(text='originalId'), batch_id=gdata.data.BatchId(text='bar')) new_entry = self.batch_feed.AddBatchEntry(entry=to_add, id_url_string='newId', batch_id_string='foo') - self.assertEquals(new_entry.batch_id.text, 'foo') - self.assertEquals(new_entry.id.text, 'originalId') + self.assertEqual(new_entry.batch_id.text, 'foo') + self.assertEqual(new_entry.id.text, 'originalId') to_add = gdata.data.BatchEntry(id=atom.data.Id(text='originalId'), batch_id=gdata.data.BatchId(text='bar')) new_entry = self.batch_feed.AddBatchEntry(entry=to_add, id_url_string='newId') - self.assertEquals(new_entry.batch_id.text, 'bar') - self.assertEquals(new_entry.id.text, 'originalId') + self.assertEqual(new_entry.batch_id.text, 'bar') + self.assertEqual(new_entry.id.text, 'originalId') to_add = gdata.data.BatchEntry(id=atom.data.Id(text='originalId'), batch_id=gdata.data.BatchId(text='bar'), batch_operation=gdata.data.BatchOperation( type=gdata.data.BATCH_INSERT)) - self.assertEquals(to_add.batch_operation.type, gdata.data.BATCH_INSERT) + self.assertEqual(to_add.batch_operation.type, gdata.data.BATCH_INSERT) new_entry = self.batch_feed.AddBatchEntry(entry=to_add, id_url_string='newId', batch_id_string='foo', operation_string=gdata.data.BATCH_UPDATE) - self.assertEquals(new_entry.batch_operation.type, gdata.data.BATCH_UPDATE) + self.assertEqual(new_entry.batch_operation.type, gdata.data.BATCH_UPDATE) def testAddInsert(self): first_entry = gdata.data.BatchEntry( id=atom.data.Id(text='http://example.com/1'), text='This is a test1') self.batch_feed.AddInsert(first_entry) - self.assertEquals(self.batch_feed.entry[0].batch_operation.type, + self.assertEqual(self.batch_feed.entry[0].batch_operation.type, gdata.data.BATCH_INSERT) - self.assertEquals(self.batch_feed.entry[0].batch_id.text, '0') + self.assertEqual(self.batch_feed.entry[0].batch_id.text, '0') second_entry = gdata.data.BatchEntry( id=atom.data.Id(text='http://example.com/2'), text='This is a test2') self.batch_feed.AddInsert(second_entry, batch_id_string='foo') - self.assertEquals(self.batch_feed.entry[1].batch_operation.type, + self.assertEqual(self.batch_feed.entry[1].batch_operation.type, gdata.data.BATCH_INSERT) - self.assertEquals(self.batch_feed.entry[1].batch_id.text, 'foo') + self.assertEqual(self.batch_feed.entry[1].batch_id.text, 'foo') third_entry = gdata.data.BatchEntry( id=atom.data.Id(text='http://example.com/3'), text='This is a test3') @@ -328,44 +328,44 @@ self.batch_feed.AddInsert(third_entry) # The batch entry should not have the original operation, it should # have been changed to an insert. - self.assertEquals(self.batch_feed.entry[2].batch_operation.type, + self.assertEqual(self.batch_feed.entry[2].batch_operation.type, gdata.data.BATCH_INSERT) - self.assertEquals(self.batch_feed.entry[2].batch_id.text, '2') + self.assertEqual(self.batch_feed.entry[2].batch_id.text, '2') def testAddDelete(self): # Try deleting an entry delete_entry = gdata.data.BatchEntry( id=atom.data.Id(text='http://example.com/1'), text='This is a test') self.batch_feed.AddDelete(entry=delete_entry) - self.assertEquals(self.batch_feed.entry[0].batch_operation.type, + self.assertEqual(self.batch_feed.entry[0].batch_operation.type, gdata.data.BATCH_DELETE) - self.assertEquals(self.batch_feed.entry[0].get_id(), + self.assertEqual(self.batch_feed.entry[0].get_id(), 'http://example.com/1') - self.assertEquals(self.batch_feed.entry[0].text, 'This is a test') + self.assertEqual(self.batch_feed.entry[0].text, 'This is a test') # Try deleting a URL self.batch_feed.AddDelete(url_string='http://example.com/2') - self.assertEquals(self.batch_feed.entry[0].batch_operation.type, + self.assertEqual(self.batch_feed.entry[0].batch_operation.type, gdata.data.BATCH_DELETE) - self.assertEquals(self.batch_feed.entry[1].id.text, + self.assertEqual(self.batch_feed.entry[1].id.text, 'http://example.com/2') - self.assert_(self.batch_feed.entry[1].text is None) + self.assertTrue(self.batch_feed.entry[1].text is None) def testAddQuery(self): # Try querying with an existing batch entry delete_entry = gdata.data.BatchEntry( id=atom.data.Id(text='http://example.com/1')) self.batch_feed.AddQuery(entry=delete_entry) - self.assertEquals(self.batch_feed.entry[0].batch_operation.type, + self.assertEqual(self.batch_feed.entry[0].batch_operation.type, gdata.data.BATCH_QUERY) - self.assertEquals(self.batch_feed.entry[0].get_id(), + self.assertEqual(self.batch_feed.entry[0].get_id(), 'http://example.com/1') # Try querying a URL self.batch_feed.AddQuery(url_string='http://example.com/2') - self.assertEquals(self.batch_feed.entry[0].batch_operation.type, + self.assertEqual(self.batch_feed.entry[0].batch_operation.type, gdata.data.BATCH_QUERY) - self.assertEquals(self.batch_feed.entry[1].id.text, + self.assertEqual(self.batch_feed.entry[1].id.text, 'http://example.com/2') def testAddUpdate(self): @@ -373,11 +373,11 @@ delete_entry = gdata.data.BatchEntry( id=atom.data.Id(text='http://example.com/1'), text='This is a test') self.batch_feed.AddUpdate(entry=delete_entry) - self.assertEquals(self.batch_feed.entry[0].batch_operation.type, + self.assertEqual(self.batch_feed.entry[0].batch_operation.type, gdata.data.BATCH_UPDATE) - self.assertEquals(self.batch_feed.entry[0].get_id(), + self.assertEqual(self.batch_feed.entry[0].get_id(), 'http://example.com/1') - self.assertEquals(self.batch_feed.entry[0].text, 'This is a test') + self.assertEqual(self.batch_feed.entry[0].text, 'RefactoringTool: No changes to ./tests/gdata_tests/data_smoke_test.py RefactoringTool: Refactored ./tests/gdata_tests/core_test.py This is a test') class ExtendedPropertyTest(unittest.TestCase): @@ -386,27 +386,27 @@ ep = gdata.data.ExtendedProperty(name='blobby') ep.SetXmlBlob('') extension = ep.GetXmlBlob() - self.assertEquals(extension.tag, 'some_xml') - self.assert_(extension.namespace is None) - self.assertEquals(extension.attributes['attr'], 'test') + self.assertEqual(extension.tag, 'some_xml') + self.assertTrue(extension.namespace is None) + self.assertEqual(extension.attributes['attr'], 'test') ep2 = parse(ep.ToString(), gdata.data.ExtendedProperty) extension = ep2.GetXmlBlob() - self.assertEquals(extension.tag, 'some_xml') - self.assert_(extension.namespace is None) - self.assertEquals(extension.attributes['attr'], 'test') + self.assertEqual(extension.tag, 'some_xml') + self.assertTrue(extension.namespace is None) + self.assertEqual(extension.attributes['attr'], 'test') def testGettersShouldReturnNoneWithNoBlob(self): ep = gdata.data.ExtendedProperty(name='no blob') - self.assert_(ep.GetXmlBlob() is None) + self.assertTrue(ep.GetXmlBlob() is None) def testGettersReturnCorrectTypes(self): ep = gdata.data.ExtendedProperty(name='has blob') ep.SetXmlBlob('') - self.assert_(isinstance(ep.GetXmlBlob(), + self.assertTrue(isinstance(ep.GetXmlBlob(), atom.core.XmlElement)) - self.assert_(isinstance(ep.GetXmlBlob().to_string(), str)) + self.assertTrue(isinstance(ep.GetXmlBlob().to_string(), str)) class FeedLinkTest(unittest.TestCase): @@ -415,7 +415,7 @@ link = parse( '', gdata.data.FeedLink) - self.assert_(isinstance(link, gdata.data.FeedLink)) + self.assertTrue(isinstance(link, gdata.data.FeedLink)) self.assertEqual(link.count_hint, '5') @@ -429,7 +429,7 @@ 'Elizabeth Bennet\'s Contacts') self.assertEqual(len(feed.entry), 2) for entry in feed.entry: - self.assert_(isinstance(entry, gdata.data.GDEntry)) + self.assertTrue(isinstance(entry, gdata.data.GDEntry)) self.assertEqual(feed.entry[0].GetElements('title')[0].text, 'Fitzwilliam') self.assertEqual(feed.entry[0].get_elements('id')[0].text, @@ -451,15 +451,15 @@ def test_constructor_defauls(self): feed = gdata.data.GDFeed() - self.assert_(feed.etag is None) + self.assertTrue(feed.etag is None) self.assertEqual(feed.link, []) self.assertEqual(feed.entry, []) entry = gdata.data.GDEntry() - self.assert_(entry.etag is None) + self.assertTrue(entry.etag is None) self.assertEqual(entry.link, []) link = atom.data.Link() - self.assert_(link.href is None) - self.assert_(link.rel is None) + self.assertTrue(link.href is None) + self.assertTrue(link.rel is None) link1 = atom.data.Link(href='http://example.com', rel='test') self.assertEqual(link1.href, 'http://example.com') self.assertEqual(link1.rel, 'test') --- ./tests/gdata_tests/core_test.py (original) +++ ./tests/gdata_tests/core_test.py (refactored) @@ -50,7 +50,7 @@ 'US","Maps"],"thumbnail": {"default": "http://i.ytimg.com/vi/hYB0mn5zh' '2c/default.jpg","hqDefault": "http://i.ytimg.com/vi/hYB0mn5zh2c/hqdef' 'ault.jpg"},"player": {"default": "http://www.youtube.com/watch?v' - '\u003dhYB0mn5zh2c"},"content": {"1": "rtsp://v5.cache3.c.youtube.com/' + '\\u003dhYB0mn5zh2c"},"content": {"1": "rtsp://v5.cache3.c.youtube.com/' 'CiILENy.../0/0/0/video.3gp","5": "http://www.youtube.com/v/hYB0mn5zh2' 'c?f...","6": "rtsp://v1.cache1.c.youtube.com/CiILENy.../0/0/0/video.3' 'gp"},"duration": 2840,"rating": 4.63,"ratingCount": 68,"viewCount": 2' @@ -64,7 +64,7 @@ json = ('{"media$group":{"media$credit":[{"$t":"GoogleDevelopers", ' '"role":"uploader", "scheme":"urn:youtube"}]}}') jsonc_obj = gdata.core.parse_json(json) - self.assert_(isinstance(jsonc_obj, gdata.core.Jsonc)) + self.assertTrue(isinstance(jsonc_obj, gdata.core.Jsonc)) raw = gdata.core._convert_to_object(jsonc_obj) self.assertEqual(raw['media$group']['media$credit'][0]['$t'], 'GoogleDevelopers') @@ -91,10 +91,10 @@ def test_pretty_print(self): x = gdata.core.Jsonc(x=1, y=2, z=3) pretty = gdata.core.prettify_jsonc(x) - self.assert_(isinstance(pretty, (str, unicode))) + self.assertTrue(isinstance(pretty, str)) pretty = gdata.core.prettify_jsonc(x, 4) - self.assert_(isinstance(pretty, (str, unicode))) + self.assertTrue(isinstance(pretty, str)) class MemberNameConversionTest(unittest.TestCase): @@ -126,17 +126,17 @@ def check_video_json(self, x): """Validates a JsoncObject similar to VIDEO_EXAMPLE.""" - self.assert_(isinstance(x._dict, dict)) - self.assert_(isinstance(x.data, gdata.core.Jsonc)) - self.assert_(isinstance(x._dict['data'], gdata.core.Jsonc)) - self.assert_(isinstance(x.data._dict, dict)) - self.assert_(isinstance(x._dict['data']._dict, dict)) - self.assert_(isinstance(x._dict['apiVersion'], (str, unicode))) - self.assert_(isinstance(x.api_version, (str, unicode))) - self.assert_(isinstance(x.data._dict['items'], list)) - self.assert_(isinstance(x.data.items[0]._dict['commentCount'], - (int, long))) - self.assert_(isinstance(x.data.items[0].favorite_count, (int, long))) + self.assertTrue(isinstance(x._dict, dict)) + self.assertTrue(isinstance(x.data, gdata.core.Jsonc)) + self.assertTrue(isinstance(x._dict['data'], gdata.core.Jsonc)) + self.assertTrue(isinstance(x.data._dict, dict)) + self.assertTrue(isinstance(x._dict['data']._dict, dict)) + self.assertTrue(isinstance(x._dict['apiVersion'], str)) + self.assertTrue(isinstance(x.api_version, str)) + self.assertTrue(isinstance(x.data._dict['items'], list)) + self.assertTrue(isinstance(x.data.items[0]._dict['commentCount'], + int)) + self.assertTrue(isinstance(x.data.items[0].favorite_count, int)) self.assertEqual(x.data.total_items, 800) self.assertEqual(x._dict['data']._dict['totalItems'], 800) self.assertEqual(x.data.items[0].view_count, 220101) @@ -154,21 +154,21 @@ def test_convert_to_jsonc(self): x = gdata.core._convert_to_jsonc(1) - self.assert_(isinstance(x, (int, long))) + self.assertTrue(isinstance(x, int)) self.assertEqual(x, 1) x = gdata.core._convert_to_jsonc([1, 'a']) - self.assert_(isinstance(x, list)) + self.assertTrue(isinstance(x, list)) self.assertEqual(len(x), 2) - self.assert_(isinstance(x[0], (int, long))) + self.assertTrue(isinstance(x[0], int)) self.assertEqual(x[0], 1) - self.assert_(isinstance(x[1], (str, unicode))) + self.assertTrue(isinstance(x[1], str)) self.assertEqual(x[1], 'a') x = gdata.core._convert_to_jsonc([{'b': 1}, 'a']) - self.assert_(isinstance(x, list)) + self.assertTrue(isinstance(x, list)) self.assertEqual(len(x), 2) - self.assert_(isinstance(x[0], gdata.core.Jsonc)) + self.assertTrue(isinstance(x[0], gdata.core.Jsonc)) self.assertEqual(x[0].b, 1) def test_non_json_members(self): @@ -186,24 +186,24 @@ self.assertEqual(gdata.core.jsonc_to_string(x).find('B'), -1) # We should find a 'b' becuse we don't consider names of dict keys in # the constructor as aliases to camelCase names. - self.assert_(not gdata.core.jsonc_to_string(x).find('b') == -1) + self.assertTrue(not gdata.core.jsonc_to_string(x).find('b') == -1) def test_constructor(self): x = gdata.core.Jsonc(a=[{'x': 'y'}, 2]) - self.assert_(isinstance(x, gdata.core.Jsonc)) - self.assert_(isinstance(x.a, list)) - self.assert_(isinstance(x.a[0], gdata.core.Jsonc)) + self.assertTrue(isinstance(x, gdata.core.Jsonc)) + self.assertTrue(isinstance(x.a, list)) + self.assertTrue(isinstance(x.a[0], gdata.core.Jsonc)) self.assertEqual(x.a[0].x, 'y') self.assertEqual(x.a[1], 2) def test_read_json(self): x = gdata.core.parse_json(PLAYLISRefactoringTool: No changes to ./tests/gdata_tests/contentforshopping_test.py RefactoringTool: Refactored ./tests/gdata_tests/contacts_test.py T_EXAMPLE) - self.assert_(isinstance(x._dict, dict)) + self.assertTrue(isinstance(x._dict, dict)) self.assertEqual(x._dict['apiVersion'], '2.0') self.assertEqual(x.api_version, '2.0') x = gdata.core.parse_json(VIDEO_EXAMPLE) - self.assert_(isinstance(x._dict, dict)) + self.assertTrue(isinstance(x._dict, dict)) self.assertEqual(x._dict['apiVersion'], '2.0') self.assertEqual(x.api_version, '2.0') @@ -311,21 +311,21 @@ x = build_test_object() # Check for expected members using different access patterns. - self.assert_(isinstance(x._dict, dict)) - self.assert_(isinstance(x['data'], gdata.core.Jsonc)) - self.assert_(isinstance(x._dict['data'], gdata.core.Jsonc)) - self.assert_(isinstance(x['data']._dict, dict)) - self.assert_(isinstance(x._dict['data']._dict, dict)) - self.assert_(isinstance(x['apiVersion'], (str, unicode))) + self.assertTrue(isinstance(x._dict, dict)) + self.assertTrue(isinstance(x['data'], gdata.core.Jsonc)) + self.assertTrue(isinstance(x._dict['data'], gdata.core.Jsonc)) + self.assertTrue(isinstance(x['data']._dict, dict)) + self.assertTrue(isinstance(x._dict['data']._dict, dict)) + self.assertTrue(isinstance(x['apiVersion'], str)) try: x['api_version'] self.fail('Should not find using Python style name') except KeyError: pass - self.assert_(isinstance(x.data['items'], list)) - self.assert_(isinstance(x.data['items'][0]._dict['commentCount'], - (int, long))) - self.assert_(isinstance(x['data'].items[0]['favoriteCount'], (int, long))) + self.assertTrue(isinstance(x.data['items'], list)) + self.assertTrue(isinstance(x.data['items'][0]._dict['commentCount'], + int)) + self.assertTrue(isinstance(x['data'].items[0]['favoriteCount'], int)) self.assertEqual(x['data'].total_items, 800) self.assertEqual(x['data']['totalItems'], 800) self.assertEqual(x.data['items'][0]['viewCount'], 220101) --- ./tests/gdata_tests/contacts_test.py (original) +++ ./tests/gdata_tests/contacts_test.py (refactored) @@ -29,55 +29,55 @@ self.entry = gdata.contacts.ContactEntryFromString(test_data.NEW_CONTACT) def testParsingTestEntry(self): - self.assertEquals(self.entry.title.text, 'Fitzgerald') - self.assertEquals(len(self.entry.email), 2) + self.assertEqual(self.entry.title.text, 'Fitzgerald') + self.assertEqual(len(self.entry.email), 2) for email in self.entry.email: if email.rel == 'http://schemas.google.com/g/2005#work': - self.assertEquals(email.address, 'liz@gmail.com') + self.assertEqual(email.address, 'liz@gmail.com') elif email.rel == 'http://schemas.google.com/g/2005#home': - self.assertEquals(email.address, 'liz@example.org') - self.assertEquals(len(self.entry.phone_number), 3) - self.assertEquals(len(self.entry.postal_address), 1) - self.assertEquals(self.entry.postal_address[0].primary, 'true') - self.assertEquals(self.entry.postal_address[0].text, + self.assertEqual(email.address, 'liz@example.org') + self.assertEqual(len(self.entry.phone_number), 3) + self.assertEqual(len(self.entry.postal_address), 1) + self.assertEqual(self.entry.postal_address[0].primary, 'true') + self.assertEqual(self.entry.postal_address[0].text, '1600 Amphitheatre Pkwy Mountain View') - self.assertEquals(len(self.entry.im), 1) - self.assertEquals(len(self.entry.group_membership_info), 1) - self.assertEquals(self.entry.group_membership_info[0].href, + self.assertEqual(len(self.entry.im), 1) + self.assertEqual(len(self.entry.group_membership_info), 1) + self.assertEqual(self.entry.group_membership_info[0].href, 'http://google.com/m8/feeds/groups/liz%40gmail.com/base/270f') - self.assertEquals(self.entry.group_membership_info[0].deleted, 'false') - self.assertEquals(len(self.entry.extended_property), 2) - self.assertEquals(self.entry.extended_property[0].name, 'pet') - self.assertEquals(self.entry.extended_property[0].value, 'hamster') - self.assertEquals(self.entry.extended_property[1].name, 'cousine') - self.assertEquals( + self.assertEqual(self.entry.group_membership_info[0].deleted, 'false') + self.assertEqual(len(self.entry.extended_property), 2) + self.assertEqual(self.entry.extended_property[0].name, 'pet') + self.assertEqual(self.entry.extended_property[0].value, 'hamster') + self.assertEqual(self.entry.extended_property[1].name, 'cousine') + self.assertEqual( self.entry.extended_property[1].GetXmlBlobExtensionElement().tag, 'italian') def testToAndFromString(self): copied_entry = gdata.contacts.ContactEntryFromString(str(self.entry)) - self.assertEquals(copied_entry.title.text, 'Fitzgerald') - self.assertEquals(len(copied_entry.email), 2) + self.assertEqual(copied_entry.title.text, 'Fitzgerald') + self.assertEqual(len(copied_entry.email), 2) for email in copied_entry.email: if email.rel == 'http://schemas.google.com/g/2005#work': - self.assertEquals(email.address, 'liz@gmail.com') + self.assertEqual(email.address, 'liz@gmail.com') elif email.rel == 'http://schemas.google.com/g/2005#home': - self.assertEquals(email.address, 'liz@example.org') - self.assertEquals(len(copied_entry.phone_number), 3) - self.assertEquals(len(copied_entry.postal_address), 1) - self.assertEquals(copied_entry.postal_address[0].primary, 'true') - self.assertEquals(copied_entry.postal_address[0].text, + self.assertEqual(email.address, 'liz@example.org') + self.assertEqual(len(copied_entry.phone_number), 3) + self.assertEqual(len(copied_entry.postal_address), 1) + self.assertEqual(copied_entry.postal_address[0].primary, 'true') + self.assertEqual(copied_entry.postal_address[0].text, '1600 Amphitheatre Pkwy Mountain View') - self.assertEquals(len(copied_entry.im), 1) - self.assertEquals(len(copied_entry.group_membership_info), 1) - self.assertEquals(copied_entry.group_membership_info[0].href, + self.assertEqual(len(copied_entry.im), 1) + self.assertEqual(len(copied_entry.group_membership_info), 1) + self.assertEqual(copied_entry.group_membership_info[0].href, 'http://google.com/m8/feeds/groups/liz%40gmail.com/base/270f') - self.assertEquals(copied_entry.group_membership_info[0].deleted, 'false') - self.assertEquals(len(copied_entry.extended_property), 2) - self.assertEquals(copied_entry.extended_property[0].name, 'pet') - self.assertEquals(copied_entry.extended_property[0].value, 'hamster') - self.assertEquals(copied_entry.extended_property[1].name, 'cousine') - self.assertEquals( + self.assertEqual(copied_entry.group_membership_info[0].deleted, 'false') + self.assertEqual(len(copied_entry.extended_property), 2) + self.assertEqual(copied_entry.extended_property[0].name, 'pet') + self.assertEqual(copied_entry.extended_property[0].value, 'hamster') + self.assertEqual(copied_entry.extended_property[1].name, 'cousine') + self.assertEqual( copied_entry.extended_property[1].GetXmlBlobExtensionElement().tag, 'italian') @@ -102,20 +102,20 @@ # Generate and parse the XML for the new entry. entry_copy = gdata.contacts.ContactEntryFromString(str(new_entry)) - self.assertEquals(entry_copy.title.text, new_entry.title.text) - self.assertEquals(entry_copy.content.text, 'Test Notes') - self.assertEquals(len(entry_copy.email), 1) - self.assertEquals(entry_copy.email[0].rel, new_entry.email[0].rel) - self.assertEquals(entry_copy.email[0].address, 'liz@gmail.com') - self.assertEquals(len(entry_copy.phone_number), 1) - self.assertEquals(entry_copy.phone_number[0].rel, + self.assertEqual(entry_copy.title.text, new_entry.title.text) + self.assertEqual(entry_copy.content.text, 'Test Notes') + self.assertEqual(len(entry_copy.email), 1) + self.assertEqual(entry_copy.email[0].rel, new_entry.email[0].rel) + self.assertEqual(entry_copy.email[0].address, 'liz@gmail.com') + self.assertEqual(len(entry_copy.phone_number), 1) + self.assertEqual(entry_copy.phone_number[0].rel, new_entry.phone_number[0].rel) - self.assertEquals(entry_copy.birthday.when, '2009-7-23') - self.assertEquals(entry_copy.phone_number[0].text, '(206)555-1212') - self.assertEquals(entry_copy.organization.org_name.text, 'TestCo.') - self.assertEquals(len(entry_copy.extended_property), 2) - self.assertEquals(entry_copy.extended_property[0].name, 'test') - self.assertEquals(entry_copy.extended_property[0].value, '1234') + self.assertEqual(entry_copy.birthday.when, '2009-7-23') + self.assertEqual(entry_copy.phone_number[0].text, '(206)555-1212') + self.assertEqual(entry_copy.organization.org_name.text, 'TestCo.') + self.assertEqual(len(entry_copy.extended_property), 2) + self.assertEqual(entry_copy.extended_property[0].name, 'test') + self.assertEqual(entry_copy.extended_property[0].value, '1234') class ContactsFeedTest(unittest.TestCase): @@ -124,26 +124,26 @@ self.feed = gdata.contacts.ContactsFeedFromString(test_data.CONTACTS_FEED) def testParsingTestFeed(self): - self.assertEquals(self.feed.id.text, + self.assertEqual(self.feed.id.text, 'http://www.google.com/m8/feeds/contacts/liz%40gmail.com/base') - self.assertEquals(self.feed.title.text, 'Contacts') - self.assertEquals(self.feed.total_results.text, '1') - self.assertEquals(len(self.feed.entry), 1) - self.assert_(isinstance(self.feed.entry[0], gdata.contacts.ContactEntry)) - self.assertEquals(self.feed.entry[0].GetPhotoLink().href, + self.assertEqual(self.feed.title.text, 'Contacts') + self.assertEqual(self.feed.total_results.text, '1') + self.assertEqual(len(self.feed.entry), 1) + self.assertTrue(isinstance(self.feed.entry[0], gdata.contacts.ContactEntry)) + self.assertEqual(self.feed.entry[0].GetPhotoLink().href, 'http://google.com/m8/feeds/photos/media/liz%40gmail.com/c9012de') - self.assertEquals(self.feed.entry[0].GetPhotoEditLink().href, + self.assertEqual(self.feed.entry[0].GetPhotoEditLink().href, 'http://www.google.com/m8/feeds/photos/media/liz%40gmail.com/' 'c9012de/photo4524') def testToAndFromString(self): copied_feed = gdata.contacts.ContactsFeedFromString(str(self.feed)) - self.assertEquals(copied_feed.id.text, + self.assertEqual(copied_feed.id.text, 'http://www.google.com/m8/feeds/contacts/liz%40gmail.com/base') - self.assertEquals(copied_feed.title.text, 'Contacts') - self.assertEquals(copied_feed.total_results.text, '1') - self.assertEquals(len(copied_feed.entry), 1) - self.assert_(isinstance(copied_feed.entry[0], gdata.contacts.ContactEntry)) + self.assertEqual(copied_feed.title.text, 'Contacts') + self.assertEqual(copied_feed.total_results.text, '1') + self.assertEqual(len(copied_feed.entry), 1) + self.assertTrue(isinstance(copied_feed.entry[0], gdata.contacts.ContactEntry)) class GroupsFeedTest(unittest.TestCase): @@ -153,11 +153,11 @@ test_data.CONTACT_GROUPS_FEED) def testParsingGroupsFeed(self): - self.assertEquals(self.feed.id.text, 'jo@gmail.com') - self.assertEquals(self.feed.title.text, 'Jo\'s Contact Groups') - self.assertEquals(self.feed.total_results.text, '3') - self.assertEquals(len(self.feed.entry), 1) - self.assert_(isinstance(self.feed.entry[0], gdata.contacts.GroupEntry)) + self.assertEqual(self.feed.id.text, 'jo@gmail.com') + self.assertEqual(self.feed.title.text, 'Jo\'s Contact Groups') + self.assertEqual(self.feed.total_results.text, '3') + self.assertEqual(len(self.feed.entry), 1) + self.assertTrue(isinstance(self.feed.entry[0], gdata.contacts.GroupEntry)) class GroupEntryTest(unittest.TestCase): @@ -167,17 +167,17 @@ test_data.CONTACT_GROUP_ENTRY) def testParsingTestEntry(self): - self.assertEquals(self.entry.title.text, 'Salsa group') - self.assertEquals(len(self.entry.extended_property), 1) - self.assertEquals(self.entry.extended_property[0].name, + self.asRefactoringTool: Refactored ./tests/gdata_tests/contacts/service_test.py sertEqual(self.entry.title.text, 'Salsa group') + self.assertEqual(len(self.entry.extended_property), 1) + self.assertEqual(self.entry.extended_property[0].name, 'more info about the group') - self.assertEquals( + self.assertEqual( self.entry.extended_property[0].GetXmlBlobExtensionElement().namespace, atom.ATOM_NAMESPACE) - self.assertEquals( + self.assertEqual( self.entry.extended_property[0].GetXmlBlobExtensionElement().tag, 'info') - self.assertEquals( + self.assertEqual( self.entry.extended_property[0].GetXmlBlobExtensionElement().text, 'Very nice people.') --- ./tests/gdata_tests/contacts/service_test.py (original) +++ ./tests/gdata_tests/contacts/service_test.py (refactored) @@ -19,7 +19,7 @@ import getpass import re import unittest -import urllib +import urllib.request, urllib.parse, urllib.error import atom import gdata.contacts.service import gdata.test_config as conf @@ -43,10 +43,10 @@ return conf.configure_service_cache(self.gd_client, 'testGetContactsFeed') feed = self.gd_client.GetContactsFeed() - self.assert_(isinstance(feed, gdata.contacts.ContactsFeed)) + self.assertTrue(isinstance(feed, gdata.contacts.ContactsFeed)) def testDefaultContactList(self): - self.assertEquals('default', self.gd_client.contact_list) + self.assertEqual('default', self.gd_client.contact_list) def testCustomContactList(self): if not conf.options.get_value('runlive') == 'true': @@ -55,11 +55,11 @@ self.gd_client.contact_list = conf.options.get_value('username') feed = self.gd_client.GetContactsFeed() - self.assert_(isinstance(feed, gdata.contacts.ContactsFeed)) + self.assertTrue(isinstance(feed, gdata.contacts.ContactsFeed)) def testGetFeedUriDefault(self): self.gd_client.contact_list = 'domain.com' - self.assertEquals('/m8/feeds/contacts/domain.com/full', + self.assertEqual('/m8/feeds/contacts/domain.com/full', self.gd_client.GetFeedUri()) def testGetFeedUriCustom(self): @@ -67,7 +67,7 @@ contact_list='example.com', projection='base/batch', scheme='https') - self.assertEquals( + self.assertEqual( 'https://www.google.com/m8/feeds/groups/example.com/base/batch', uri) def testCreateUpdateDeleteContactAndUpdatePhoto(self): @@ -94,25 +94,25 @@ entry = self.gd_client.CreateContact(new_entry) # Generate and parse the XML for the new entry. - self.assertEquals(entry.title.text, new_entry.title.text) - self.assertEquals(entry.content.text, 'Test Notes') - self.assertEquals(len(entry.email), 1) - self.assertEquals(entry.email[0].rel, new_entry.email[0].rel) - self.assertEquals(entry.email[0].address, 'liz@gmail.com') - self.assertEquals(len(entry.phone_number), 1) - self.assertEquals(entry.phone_number[0].rel, + self.assertEqual(entry.title.text, new_entry.title.text) + self.assertEqual(entry.content.text, 'Test Notes') + self.assertEqual(len(entry.email), 1) + self.assertEqual(entry.email[0].rel, new_entry.email[0].rel) + self.assertEqual(entry.email[0].address, 'liz@gmail.com') + self.assertEqual(len(entry.phone_number), 1) + self.assertEqual(entry.phone_number[0].rel, new_entry.phone_number[0].rel) - self.assertEquals(entry.phone_number[0].text, '(206)555-1212') - self.assertEquals(entry.organization.org_name.text, 'TestCo.') + self.assertEqual(entry.phone_number[0].text, '(206)555-1212') + self.assertEqual(entry.organization.org_name.text, 'TestCo.') # Edit the entry. entry.phone_number[0].text = '(555)555-1212' updated = self.gd_client.UpdateContact(entry.GetEditLink().href, entry) - self.assertEquals(updated.content.text, 'Test Notes') - self.assertEquals(len(updated.phone_number), 1) - self.assertEquals(updated.phone_number[0].rel, + self.assertEqual(updated.content.text, 'Test Notes') + self.assertEqual(len(updated.phone_number), 1) + self.assertEqual(updated.phone_number[0].rel, entry.phone_number[0].rel) - self.assertEquals(updated.phone_number[0].text, '(555)555-1212') + self.assertEqual(updated.phone_number[0].text, '(555)555-1212') # Change the contact's photo. updated_photo = self.gd_client.ChangePhoto( @@ -121,11 +121,11 @@ # Refetch the contact so that it has the new photo link updated = self.gd_client.GetContact(updated.GetSelfLink().href) - self.assert_(updated.GetPhotoLink() is not None) + self.assertTrue(updated.GetPhotoLink() is not None) # Fetch the photo data. hosted_image = self.gd_client.GetPhoto(updated) - self.assert_(hosted_image is not None) + self.assertTrue(hosted_image is not None) # Delete the entry. self.gd_client.DeleteContact(updated.GetEditLink().href) @@ -160,17 +160,17 @@ batch_result = self.gd_client.ExecuteBatch(batch_request, default_batch_url) - self.assertEquals(len(batch_result.entry), 1) - self.assertEquals(batch_result.entry[0].title.text, + self.assertEqual(len(batch_result.entry), 1) + self.assertEqual(batch_result.entry[0].title.text, random_contact_title) - self.assertEquals(batch_result.entry[0].batch_operation.type, + self.assertEqual(batch_result.entry[0].batch_operation.type, gdata.BATCH_INSERT) - self.assertEquals(batch_result.entry[0].batch_status.code, + self.assertEqual(batch_result.entry[0].batch_status.code, '201') expected_batch_url = re.compile('default').sub( - urllib.quote(self.gd_client.email), + urllib.parse.quote(self.gd_client.email), gdata.contacts.service.DEFAULT_BATCH_URL) - self.failUnless(batch_result.GetBatchLink().href, + self.assertTrue(batch_result.GetBatchLink().href, expected_batch_url) # Create a batch request to delete the newly created entry. @@ -180,18 +180,18 @@ batch_delete_result = self.gd_client.ExecuteBatch( batch_delete_request, batch_result.GetBatchLink().href) - self.assertEquals(len(batch_delete_result.entry), 1) - self.assertEquals(batch_delete_result.entry[0].batch_operation.type, + self.assertEqual(len(batch_delete_result.entry), 1) + self.assertEqual(batch_delete_result.entry[0].batch_operation.type, gdata.BATCH_DELETE) - self.assertEquals(batch_result.entry[0].batch_status.code, + self.assertEqual(batch_result.entry[0].batch_status.code, '201') def testCleanUriNeedsCleaning(self): - self.assertEquals('/relative/uri', self.gd_client._CleanUri( + self.assertEqual('/relative/uri', self.gd_client._CleanUri( 'http://www.google.com/relative/uri')) def testCleanUriDoesNotNeedCleaning(self): - self.assertEquals('/relative/uri', self.gd_client._CleanUri( + self.assertEqual('/relative/uri', self.gd_client._CleanUri( '/relative/uri')) @@ -199,21 +199,21 @@ def testConvertToStringDefaultFeed(self): query = gdata.contacts.service.ContactsQuery() - self.assertEquals(str(query), '/m8/feeds/contacts/default/full') + self.assertEqual(str(query), '/m8/feeds/contacts/default/full') query.max_results = 10 - self.assertEquals(query.ToUri(), + self.assertEqual(query.ToUri(), '/m8/feeds/contacts/default/full?max-results=10') def testConvertToStringCustomFeed(self): query = gdata.contacts.service.ContactsQuery('/custom/feed/uri') - self.assertEquals(str(query), '/custom/feed/uri') + self.assertEqual(str(query), '/custom/feed/uri') query.max_results = '10' - self.assertEquals(query.ToUri(), '/custom/feed/uri?max-results=10') + self.assertEqual(query.ToUri(), '/custom/feed/uri?max-results=10') def testGroupQueryParameter(self): query = gdata.contacts.service.ContactsQuery() query.group = 'http://google.com/m8/feeds/groups/liz%40gmail.com/full/270f' - seRefactoringTool: Refactored ./tests/gdata_tests/contacts/profiles/service_test.py lf.assertEquals(query.ToUri(), '/m8/feeds/contacts/default/full' + self.assertEqual(query.ToUri(), '/m8/feeds/contacts/default/full' '?group=http%3A%2F%2Fgoogle.com%2Fm8%2Ffeeds%2Fgroups' '%2Fliz%2540gmail.com%2Ffull%2F270f') @@ -236,14 +236,14 @@ test_group = gdata.contacts.GroupEntry(title=atom.Title( text='test group py')) new_group = self.gd_client.CreateGroup(test_group) - self.assert_(isinstance(new_group, gdata.contacts.GroupEntry)) - self.assertEquals(new_group.title.text, 'test group py') + self.assertTrue(isinstance(new_group, gdata.contacts.GroupEntry)) + self.assertEqual(new_group.title.text, 'test group py') # Change the group's title new_group.title.text = 'new group name py' updated_group = self.gd_client.UpdateGroup(new_group.GetEditLink().href, new_group) - self.assertEquals(updated_group.title.text, new_group.title.text) + self.assertEqual(updated_group.title.text, new_group.title.text) # Remove the group self.gd_client.DeleteGroup(updated_group.GetEditLink().href) --- ./tests/gdata_tests/contacts/profiles/service_test.py (original) +++ ./tests/gdata_tests/contacts/profiles/service_test.py (refactored) @@ -53,34 +53,34 @@ def testGetFeedUriCustom(self): uri = self.gd_client.GetFeedUri(kind='profiles', scheme='https') - self.assertEquals( + self.assertEqual( 'https://%s/m8/feeds/profiles/domain/%s/full' % (server, domain), uri) def testGetProfileFeedUriDefault(self): self.gd_client.contact_list = 'domain.com' - self.assertEquals('/m8/feeds/profiles/domain/domain.com/full', + self.assertEqual('/m8/feeds/profiles/domain/domain.com/full', self.gd_client.GetFeedUri('profiles')) def testCleanUriNeedsCleaning(self): - self.assertEquals('/relative/uri', self.gd_client._CleanUri( + self.assertEqual('/relative/uri', self.gd_client._CleanUri( 'http://www.google.com/relative/uri')) def testCleanUriDoesNotNeedCleaning(self): - self.assertEquals('/relative/uri', self.gd_client._CleanUri( + self.assertEqual('/relative/uri', self.gd_client._CleanUri( '/relative/uri')) def testGetProfilesFeed(self): feed = self.gd_client.GetProfilesFeed() - self.assert_(isinstance(feed, gdata.contacts.ProfilesFeed)) + self.assertTrue(isinstance(feed, gdata.contacts.ProfilesFeed)) def testGetProfile(self): # Gets an existing entry feed = self.gd_client.GetProfilesFeed() entry = feed.entry[0] - self.assert_(isinstance(entry, gdata.contacts.ProfileEntry)) - self.assertEquals(entry.title.text, + self.assertTrue(isinstance(entry, gdata.contacts.ProfileEntry)) + self.assertEqual(entry.title.text, self.gd_client.GetProfile(entry.id.text).title.text) - self.assertEquals(entry._children, + self.assertEqual(entry._children, self.gd_client.GetProfile(entry.id.text)._children) def testUpdateProfile(self): @@ -89,7 +89,7 @@ original_occupation = entry.occupation entry.occupation = gdata.contacts.Occupation(text='TEST') updated = self.gd_client.UpdateProfile(entry.GetEditLink().href, entry) - self.assertEquals('TEST', updated.occupation.text) + self.assertEqual('TEST', updated.occupation.text) updated.occupation = original_occupation self.gd_client.UpdateProfile(updated.GetEditLink().href, updated) @@ -98,7 +98,7 @@ try: opts, args = getopt.getopt(sys.argv[1:], '', ['user=', 'pw=', 'domain=']) - except getopt.error, msg: + except getopt.error as msg: print ('Profiles Tests\nNOTE: Please run these tests only with a test ' 'account. The tests may delete or update your data.\n' '\nUsage: service_test.py --email=EMAIL ' @@ -115,15 +115,15 @@ domain = arg while not email: - print 'NOTE: Please run these tests only with a test account.' - email = raw_input('Please enter your email: ') + print('NOTE: Please run these tests only with a test account.') + email RefactoringTool: Refactored ./tests/gdata_tests/contacts/profiles/live_client_test.py RefactoringTool: Refactored ./tests/gdata_tests/contacts/live_client_test.py RefactoringTool: Refactored ./tests/gdata_tests/codesearch_test.py = input('Please enter your email: ') while not password: password = getpass.getpass('Please enter password: ') if not password: - print 'Password cannot be blank.' + print('Password cannot be blank.') while not domain: - print 'NOTE: Please run these tests only with a test account.' - domain = raw_input('Please enter your Apps domain: ') + print('NOTE: Please run these tests only with a test account.') + domain = input('Please enter your Apps domain: ') suite = unittest.makeSuite(ProfilesServiceTest) unittest.TextTestRunner().run(suite) --- ./tests/gdata_tests/contacts/profiles/live_client_test.py (original) +++ ./tests/gdata_tests/contacts/profiles/live_client_test.py (refactored) @@ -56,7 +56,7 @@ conf.configure_cache(self.client, 'test_profiles_feed') feed = self.client.get_profiles_feed() - self.assert_(isinstance(feed, gdata.contacts.data.ProfilesFeed)) + self.assertTrue(isinstance(feed, gdata.contacts.data.ProfilesFeed)) def test_profiles_query(self): if not conf.options.get_value('runlive') == 'true': @@ -66,8 +66,8 @@ query = gdata.contacts.client.ProfilesQuery(max_results=1) feed = self.client.get_profiles_feed(q=query) - self.assert_(isinstance(feed, gdata.contacts.data.ProfilesFeed)) - self.assert_(len(feed.entry) == 1) + self.assertTrue(isinstance(feed, gdata.contacts.data.ProfilesFeed)) + self.assertTrue(len(feed.entry) == 1) # Needs at least 2 profiles in the feed to test the start-key # query param. @@ -79,13 +79,13 @@ if 'start-key' in uri.query: query.start_key = uri.query['start-key'] feed = self.client.get_profiles_feed(q=query) - self.assert_(isinstance(feed, gdata.contacts.data.ProfilesFeed)) - self.assert_(len(feed.entry) == 1) - self.assert_(feed.GetSelfLink().href == next.href) + self.assertTrue(isinstance(feed, gdata.contacts.data.ProfilesFeed)) + self.assertTrue(len(feed.entry) == 1) + self.assertTrue(feed.GetSelfLink().href == next.href) # Compare with a feed retrieved with the next link. next_feed = self.client.get_profiles_feed(uri=next.href) - self.assert_(len(next_feed.entry) == 1) - self.assert_(next_feed.entry[0].id.text == feed.entry[0].id.text) + self.assertTrue(len(next_feed.entry) == 1) + self.assertTrue(next_feed.entry[0].id.text == feed.entry[0].id.text) def suite(): return conf.build_suite([ProfileTest]) --- ./tests/gdata_tests/contacts/live_client_test.py (original) +++ ./tests/gdata_tests/contacts/live_client_test.py (refactored) @@ -66,7 +66,7 @@ title=atom.data.Title(text='a test group')) created_group = self.client.create_group(new_group) - self.assert_(created_group.id.text) + self.assertTrue(created_group.id.text) # Add the contact to the new group. created.group_membership_info.append( @@ -102,12 +102,12 @@ self_link = link.get_attributes('href')[0].value elif link.get_attributes('rel')[0].value == 'edit': edit_link = link.get_attributes('href')[0].value - self.assert_(self_link is not None) - self.assert_(edit_link is not None) + self.assertTrue(self_link is not None) + self.assertTrue(edit_link is not None) etag = posted.get_attributes('etag')[0].value - self.assert_(etag is not None) - self.assert_(len(etag) > 0) + self.assertTrue(etag is not None) + self.assertTrue(len(etag) > 0) # Delete the test contact. http_request = atom.http_core.HttpRequest() --- ./tests/gdata_tests/codesearch_test.py (original) +++ ./tests/gdata_tests/codesearch_test.py (refactored) @@ -29,23 +29,23 @@ gdata.test_data.CODE_SEARCH_FEED) def testCorrectXmlConversion(self): - self.assert_(self.feed.id.text == + self.assertTrue(self.feed.id.text == 'http://www.google.com/codesearch/feeds/search?q=malloc') - self.assert_(len(self.feed.entry) == 10) + self.assertTrue(len(self.feed.entry) == 10) for entry in self.feed.entry: if enRefactoringTool: Refactored ./tests/gdata_tests/client_test.py try.id.text == ('http://www.google.com/codesearch?hl=en&q=+ma' 'lloc+show:LDjwp-Iqc7U:84hEYaYsZk8:xDGReDhvNi0&sa=N&ct=rx&cd=1' '&cs_p=http://www.gnu.org&cs_f=software/autoconf/manual/autoco' 'nf-2.60/autoconf.html-002&cs_p=http://www.gnu.org&cs_f=softwa' 're/autoconf/manual/autoconf-2.60/autoconf.html-002#first'): - self.assert_(len(entry.match) == 4) + self.assertTrue(len(entry.match) == 4) for match in entry.match: if match.line_number == '4': - self.assert_(match.type == 'text/html') - self.assert_(entry.file.name == + self.assertTrue(match.type == 'text/html') + self.assertTrue(entry.file.name == 'software/autoconf/manual/autoconf-2.60/autoconf.html-002') - self.assert_(entry.package.name == 'http://www.gnu.org') - self.assert_(entry.package.uri == 'http://www.gnu.org') + self.assertTrue(entry.package.name == 'http://www.gnu.org') + self.assertTrue(entry.package.uri == 'http://www.gnu.org') if __name__ == '__main__': --- ./tests/gdata_tests/client_test.py (original) +++ ./tests/gdata_tests/client_test.py (refactored) @@ -26,7 +26,7 @@ import gdata.gauth import gdata.data import atom.mock_http_core -import StringIO +import io class ClientLoginTest(unittest.TestCase): @@ -38,7 +38,7 @@ 'LSID=DQAAAGsA...lk8BBbG\n' 'Auth=DQAAAGgA...dk3fA5N', {'Content-Type': 'text/plain'}) token = client.request_client_login_token('email', 'pw', 'cp', 'test') - self.assert_(isinstance(token, gdata.gauth.ClientLoginToken)) + self.assertTrue(isinstance(token, gdata.gauth.ClientLoginToken)) self.assertEqual(token.token_string, 'DQAAAGgA...dk3fA5N') # Test a server response without a ClientLogin token.` @@ -64,11 +64,11 @@ token = client.request_client_login_token('email', 'pw', '', '') self.fail('should raise a CaptchaChallenge on a 403 with a ' 'CaptchRequired error.') - except gdata.client.CaptchaChallenge, challenge: - self.assertEquals(challenge.captcha_url, + except gdata.client.CaptchaChallenge as challenge: + self.assertEqual(challenge.captcha_url, 'http://www.google.com/accounts/' 'Captcha?ctoken=HiteT4bVoP6-yFkHPibe7O9EqxeiI7lUSN') - self.assertEquals(challenge.captcha_token, 'DQAAAGgA...dkI1LK9') + self.assertEqual(challenge.captcha_token, 'DQAAAGgA...dkI1LK9') # Test an unexpected response, a 404 for example. client.http_client.set_response(404, 'ignored', '', {}) @@ -82,7 +82,7 @@ 'LSID=DQAAAGsA...lk8BBbG\n' 'Auth=DQAAAGgA...dk3fA5N', {'Content-Type': 'text/plain'}) client.client_login('me@example.com', 'password', 'wise', 'unit test') - self.assert_(isinstance(client.auth_token, gdata.gauth.ClientLoginToken)) + self.assertTrue(isinstance(client.auth_token, gdata.gauth.ClientLoginToken)) self.assertEqual(client.auth_token.token_string, 'DQAAAGgA...dk3fA5N') @@ -98,12 +98,12 @@ client.auth_token = gdata.gauth.AuthSubToken.from_url(page_url) - self.assert_(isinstance(client.auth_token, gdata.gauth.AuthSubToken)) + self.assertTrue(isinstance(client.auth_token, gdata.gauth.AuthSubToken)) self.assertEqual(client.auth_token.token_string, 'CKF50YzIHxCTKMAg') upgraded = client.upgrade_token() - self.assert_(isinstance(client.auth_token, gdata.gauth.AuthSubToken)) + self.assertTrue(isinstance(client.auth_token, gdata.gauth.AuthSubToken)) self.assertEqual(client.auth_token.token_string, 'UpgradedTokenVal') self.assertEqual(client.auth_token, upgraded) @@ -128,7 +128,7 @@ page_url = 'http://example.com/showcalendar.html?token=CKF50YzIHxCTKMAg' client.auth_token = gdata.gauth.AuthSubToken.from_url(page_url) deleted = client.revoke_token() - self.assert_(deleted) + self.assertTrue(deleted) self.assertEqual( client.http_client.last_request.headers['Authorization'], 'AuthSub token=CKF50YzIHxCTKMAg') @@ -151,18 +151,18 @@ # Also check the Authorization header which was sent in the request. auth_header = client.http_client.last_request.headers['Authorization'] - self.assert_('OAuth' in auth_header) - self.assert_( + self.assertTrue('OAuth' in auth_header) + self.assertTrue( 'oauth_callback="http%3A%2F%2Fexample.net%2Fmyapp"' in auth_header) - self.assert_('oauth_version="1.0"' in auth_header) - self.assert_('oauth_signature_method="HMAC-SHA1"' in auth_header) - self.assert_('oauth_consumer_key="consumer"' in auth_header) + self.assertTrue('oauth_version="1.0"' in auth_header) + self.assertTrue('oauth_signature_method="HMAC-SHA1"' in auth_header) + self.assertTrue('oauth_consumer_key="consumer"' in auth_header) # Check generation of the authorization URL. authorize_url = request_token.generate_authorization_url() - self.assert_(str(authorize_url).startswith( + self.assertTrue(str(authorize_url).startswith( 'https://www.google.com/accounts/OAuthAuthorizeToken')) - self.assert_('oauth_token=ab3cd9j4ks7' in str(authorize_url)) + self.assertTrue('oauth_token=ab3cd9j4ks7' in str(authorize_url)) # Check that the token information from the browser's URL is parsed. redirected_url = ( @@ -179,21 +179,21 @@ access_token = client.get_access_token(request_token) self.assertEqual(request_token.token, '3cd9Fj417') self.assertEqual(request_token.token_secret, 'Xhrh6bXBs') - self.assert_(request_token.verifier is None) + self.assertTrue(request_token.verifier is None) self.assertEqual(request_token.auth_state, gdata.gauth.ACCESS_TOKEN) self.assertEqual(request_token.token, access_token.token) self.assertEqual(request_token.token_secret, access_token.token_secret) - self.assert_(access_token.verifier is None) + self.assertTrue(access_token.verifier is None) self.assertEqual(request_token.auth_state, access_token.auth_state) # Also check the Authorization header which was sent in the request. auth_header = client.http_client.last_request.headers['Authorization'] - self.assert_('OAuth' in auth_header) - self.assert_('oauth_callback="' not in auth_header) - self.assert_('oauth_version="1.0"' in auth_header) - self.assert_('oauth_verifier="Xhhbas"' in auth_header) - self.assert_('oauth_signature_method="HMAC-SHA1"' in auth_header) - self.assert_('oauth_consumer_key="consumer"' in auth_header) + self.assertTrue('OAuth' in auth_header) + self.assertTrue('oauth_callback="' not in auth_header) + self.assertTrue('oauth_version="1.0"' in auth_header) + self.assertTrue('oauth_verifier="Xhhbas"' in auth_header) + self.assertTrue('oauth_signature_method="HMAC-SHA1"' in auth_header) + self.assertTrue('oauth_consumer_key="consumer"' in auth_header) class RequestTest(unittest.TestCase): @@ -264,8 +264,8 @@ try: response = client.request(method='PUT', uri='http://example.com/2?gsessionid=loop') self.fail('Loop URL should have redirected forever.') - except gdata.client.RedirectError, err: - self.assert_(str(err).startswith('Too many redirects from server')) + except gdata.client.RedirectError as err: + self.assertTrue(str(err).startswith('Too many redirects from server')) def test_lowercase_location(self): client = gdata.client.GDClient() @@ -302,11 +302,11 @@ client.http_client = atom.mock_http_core.EchoHttpClient() test_entry = gdata.data.GDEntry() result = client.post(test_entry, 'http://example.com') - self.assert_(isinstance(result, gdata.data.GDEntry)) + self.assertTrue(isinstance(result, gdata.data.GDEntry)) result = client.post(test_entry, 'http://example.com', converter=bad_converter) - self.assertEquals(result, 1) + self.assertEqual(result, 1) result = client.post(test_entry, 'http://example.com', desired_class=TestClass) - self.assert_(isinstance(result, TestClass)) + self.assertTrue(isinstance(result, TestClass)) class QueryTest(unittest.TestCase): @@ -334,13 +334,13 @@ RefactoringTool: No changes to ./tests/gdata_tests/client_smoke_test.py RefactoringTool: Refactored ./tests/gdata_tests/calendar_test.py class VersionConversionTest(unittest.TestCase): def test_use_default_version(self): - self.assertEquals(gdata.client.get_xml_version(None), 1) + self.assertEqual(gdata.client.get_xml_version(None), 1) def test_str_to_int_version(self): - self.assertEquals(gdata.client.get_xml_version('1'), 1) - self.assertEquals(gdata.client.get_xml_version('2'), 2) - self.assertEquals(gdata.client.get_xml_version('2.1.2'), 2) - self.assertEquals(gdata.client.get_xml_version('10.4'), 10) + self.assertEqual(gdata.client.get_xml_version('1'), 1) + self.assertEqual(gdata.client.get_xml_version('2'), 2) + self.assertEqual(gdata.client.get_xml_version('2.1.2'), 2) + self.assertEqual(gdata.client.get_xml_version('10.4'), 10) class UpdateTest(unittest.TestCase): --- ./tests/gdata_tests/calendar_test.py (original) +++ ./tests/gdata_tests/calendar_test.py (refactored) @@ -37,21 +37,21 @@ def testEntryCount(self): # Assert the number of items in the feed of calendars - self.assertEquals(len(self.calendar_feed.entry),2) + self.assertEqual(len(self.calendar_feed.entry),2) def testToAndFromString(self): # Assert the appropriate type for each entry for an_entry in self.calendar_feed.entry: - self.assert_(isinstance(an_entry, gdata.calendar.CalendarListEntry), + self.assertTrue(isinstance(an_entry, gdata.calendar.CalendarListEntry), 'Entry must be an instance of CalendarListEntry') # Regenerate feed from xml text new_calendar_feed = ( gdata.calendar.CalendarListFeedFromString(str(self.calendar_feed))) for an_entry in new_calendar_feed.entry: - self.assert_(isinstance(an_entry, gdata.calendar.CalendarListEntry), + self.assertTrue(isinstance(an_entry, gdata.calendar.CalendarListEntry), 'Entry in regenerated feed must be an instance of CalendarListEntry') def testAuthor(self): @@ -59,21 +59,21 @@ # Assert that each element in the feed author list is an atom.Author for an_author in self.calendar_feed.author: - self.assert_(isinstance(an_author, atom.Author), + self.assertTrue(isinstance(an_author, atom.Author), "Calendar feed element must be an instance of " + "atom.Author: %s" % an_author) # Assert the feed author name is as expected - self.assertEquals(self.calendar_feed.author[0].name.text, 'GData Ops Demo') + self.assertEqual(self.calendar_feed.author[0].name.text, 'GData Ops Demo') # Assert the feed author name is as expected - self.assertEquals(self.calendar_feed.author[0].email.text, + self.assertEqual(self.calendar_feed.author[0].email.text, 'gdata.ops.demo@gmail.com') # Assert one of the values for an entry author - self.assertEquals(self.calendar_feed.entry[0].author[0].name.text, + self.assertEqual(self.calendar_feed.entry[0].author[0].name.text, 'GData Ops Demo') - self.assertEquals(self.calendar_feed.entry[0].author[0].email.text, + self.assertEqual(self.calendar_feed.entry[0].author[0].email.text, 'gdata.ops.demo@gmail.com') def testId(self): @@ -81,22 +81,22 @@ and verifies the value""" # Assert the feed id exists and is an atom.Id - self.assert_(isinstance(self.calendar_feed.id, atom.Id), + self.assertTrue(isinstance(self.calendar_feed.id, atom.Id), "Calendar feed element must be an instance of atom.Id: %s" % ( self.calendar_feed.id)) # Assert the feed id value is as expected - self.assertEquals(self.calendar_feed.id.text, + self.assertEqual(self.calendar_feed.id.text, 'http://www.google.com/calendar/feeds/default') # Assert that each entry has an id which is an atom.Id for an_entry in self.calendar_feed.entry: - self.assert_(isinstance(an_entry.id, atom.Id), + self.assertTrue(isinstance(an_entry.id, atom.Id), "Calendar entry element must be an instance of " + "atom.Id: %s" % an_entry.id) # Assert one of the values for an id - self.assertEquals(self.calendar_feed.entry[1].id.text, + self.assertEqual(self.calendar_feed.entry[1].id.text, 'http://www.google.com/calendar/feeds/default/' + 'jnh21ovnjgfph21h32gvms2758%40group.calendar.google.com') @@ -106,12 +106,12 @@ # Assert that each entry has a published value which is an atom.Published for an_entry in self.calendar_feed.entry: - self.assert_(isinstance(an_entry.published, atom.Published), + self.assertTrue(isinstance(an_entry.published, atom.Published), "Calendar entry element must be an instance of " + "atom.Published: %s" % an_entry.published) # Assert one of the values for published is as expected - self.assertEquals(self.calendar_feed.entry[1].published.text, + self.assertEqual(self.calendar_feed.entry[1].published.text, '2007-03-20T22:48:57.837Z') def testUpdated(self): @@ -119,22 +119,22 @@ and verifies the value""" # Assert that the feed updated element exists and is an atom.Updated - self.assert_(isinstance(self.calendar_feed.updated, atom.Updated), + self.assertTrue(isinstance(self.calendar_feed.updated, atom.Updated), "Calendar feed element must be an instance of " + "atom.Updated: %s" % self.calendar_feed.updated) # Assert that each entry has a updated value which is an atom.Updated for an_entry in self.calendar_feed.entry: - self.assert_(isinstance(an_entry.updated, atom.Updated), + self.assertTrue(isinstance(an_entry.updated, atom.Updated), "Calendar entry element must be an instance of" + "atom.Updated: %s" % an_entry.updated) # Assert the feed updated value is as expected - self.assertEquals(self.calendar_feed.updated.text, + self.assertEqual(self.calendar_feed.updated.text, '2007-03-20T22:48:57.833Z') # Assert one of the values for updated - self.assertEquals(self.calendar_feed.entry[0].updated.text, + self.assertEqual(self.calendar_feed.entry[0].updated.text, '2007-03-20T22:48:52.000Z') def testTitle(self): @@ -142,34 +142,34 @@ verifies the value""" # Assert that the feed title element exists and is an atom.Title - self.assert_(isinstance(self.calendar_feed.title, atom.Title), + self.assertTrue(isinstance(self.calendar_feed.title, atom.Title), "Calendar feed element must be an instance of " + "atom.Title: %s" % self.calendar_feed.title) # Assert that each entry has a title value which is an atom.Title for an_entry in self.calendar_feed.entry: - self.assert_(isinstance(an_entry.title, atom.Title), + self.assertTrue(isinstance(an_entry.title, atom.Title), "Calendar entry element must be an instance of " + "atom.Title: %s" % an_entry.title) # Assert the feed title value is as expected - self.assertEquals(self.calendar_feed.title.text, + self.assertEqual(self.calendar_feed.title.text, 'GData Ops Demo\'s Calendar List') # Assert one of the values for title - self.assertEquals(self.calendar_feed.entry[0].title.text, 'GData Ops Demo') + self.assertEqual(self.calendar_feed.entry[0].title.text, 'GData Ops Demo') def testColor(self): """Tests the existence of a and verifies the value""" # Assert the color is present and is a gdata.calendar.Color for an_entry in self.calendar_feed.entry: - self.assert_(isinstance(an_entry.color, gdata.calendar.Color), + self.assertTrue(isinstance(an_entry.color, gdata.calendar.Color), "Calendar feed element must be an instance of " + "gdata.calendar.Color: %s" % an_entry.color) # Assert the color value is as expected - self.assertEquals(self.calendar_feed.entry[0].color.value, '#2952A3') + self.assertEqual(self.calendar_feed.entry[0].color.value, '#2952A3') def testAccessLevel(self): """Tests the existence of a element and verifies the @@ -177,12 +177,12 @@ # Assert the access_level is present and is a gdata.calendar.AccessLevel for an_entry in self.calendar_feed.entry: - self.assert_(isinstance(an_entry.access_level, gdata.calendar.AccessLevel), + self.assertTrue(isinstance(an_entry.access_level, gdata.calendar.AccessLevel), "Calendar feed element must be an instance of " + "gdata.calendar.AccessLevel: %s" % an_entry.access_level) # Assert the access_level value is as expected - self.assertEquals(self.calendar_feed.entry[0].access_level.value, 'owner') + self.assertEqual(self.calendar_feed.entry[0].access_level.value, 'owner') def testTimezone(self): """Tests the existence of a element and verifies the @@ -190,12 +190,12 @@ # Assert the timezone is present and is a gdata.calendar.Timezone for an_entry in self.calendar_feed.entry: - self.assert_(isinstance(an_entry.timezone, gdata.calendar.Timezone), + self.assertTrue(isinstance(an_entry.timezone, gdata.calendar.Timezone), "Calendar feed element must be an instance of " + "gdata.calendar.Timezone: %s" % an_entry.timezone) # Assert the timezone value is as expected - self.assertEquals(self.calendar_feed.entry[0].timezone.value, + self.assertEqual(self.calendar_feed.entry[0].timezone.value, 'America/Los_Angeles') def testHidden(self): @@ -204,35 +204,35 @@ # Assert the hidden is present and is a gdata.calendar.Hidden for an_entry in self.calendar_feed.entry: - self.assert_(isinstance(an_entry.hidden, gdata.calendar.Hidden), + self.assertTrue(isinstance(an_entry.hidden, gdata.calendar.Hidden), "Calendar feed element must be an instance of " + "gdata.calendar.Hidden: %s" % an_entry.hidden) # Assert the hidden value is as expected - self.assertEquals(self.calendar_feed.entry[0].hidden.value, 'false') + self.assertEqual(self.calendar_feed.entry[0].hidden.value, 'false') def testOpenSearch(self): """Tests the existence of """ # Assert that the elements exist and are the appropriate type - self.assert_(isinstance(self.calendar_feed.start_index, gdata.StartIndex), + self.assertTrue(isinstance(self.calendar_feed.start_index, gdata.StartIndex), "Calendar feed element must be an " + "instance of gdata.StartIndex: %s" % self.calendar_feed.start_index) # Assert the values for each openSearch element are as expected - self.assertEquals(self.calendar_feed.start_index.text, '1') + self.assertEqual(self.calendar_feed.start_index.text, '1') def testGenerator(self): """Tests the existence of and verifies the value""" # Assert that the element exists and is of the appropriate type - self.assert_(isinstance(self.calendar_feed.generator, atom.Generator), + self.assertTrue(isinstance(self.calendar_feed.generator, atom.Generator), "Calendar feed element must be an instance of " + "atom.Generator: %s" % self.calendar_feed.generator) # Assert the generator version, uri and text are as expected - self.assertEquals(self.calendar_feed.generator.text, 'Google Calendar') - self.assertEquals(self.calendar_feed.generator.version, '1.0') - self.assertEquals(self.calendar_feed.generator.uri, + self.assertEqual(self.calendar_feed.generator.text, 'Google Calendar') + self.assertEqual(self.calendar_feed.generator.version, '1.0') + self.assertEqual(self.calendar_feed.generator.uri, 'http://www.google.com/calendar') def testEntryLink(self): @@ -241,12 +241,12 @@ entry = gdata.calendar.CalendarEventEntryFromString( test_data.RECURRENCE_EXCEPTION_ENTRY) - self.assert_(isinstance(entry.recurrence_exception, list)) - self.assert_(isinstance(entry.recurrence_exception[0].entry_link, + self.assertTrue(isinstance(entry.recurrence_exception, list)) + self.assertTrue(isinstance(entry.recurrence_exception[0].entry_link, gdata.EntryLink)) - self.assert_(isinstance(entry.recurrence_exception[0].entry_link.entry, + self.assertTrue(isinstance(entry.recurrence_exception[0].entry_link.entry, gdata.calendar.CalendarEventEntry)) - self.assertEquals( + self.assertEqual( entry.recurrence_exception[0].entry_link.entry.author[0].name.text, 'gdata ops') @@ -266,7 +266,7 @@ entry = gdata.calendar.CalendarEventEntryFromString( test_data.RECURRENCE_EXCEPTION_ENTRY) - self.assertEquals( + self.assertEqual( entry.recurrence_exception[0].entry_link.entry.original_event.id, 'i7lgfj69mjqjgnodklif3vbm7g') @@ -289,19 +289,19 @@ def testEntryCount(self): # Assert the number of items in the feed of events - self.assertEquals(len(self.calendar_event_feed.entry),11) + self.assertEqual(len(self.calendar_event_feed.entry),11) def testToAndFromString(self): # Assert the appropriate type for each entry for an_entry in self.calendar_event_feed.entry: - self.assert_(isinstance(an_entry, gdata.calendar.CalendarEventEntry), + self.assertTrue(isinstance(an_entry, gdata.calendar.CalendarEventEntry), "Entry must be an instance of a CalendarEventEntry") # Regenerate feed from xml text new_calendar_event_feed = gdata.calendar.CalendarEventFeedFromString( str(self.calendar_event_feed)) for an_entry in new_calendar_event_feed.entry: - self.assert_(isinstance(an_entry, gdata.calendar.CalendarEventEntry), + self.assertTrue(isinstance(an_entry, gdata.calendar.CalendarEventEntry), "Entry in regenerated feed must be an instance of CalendarEventEntry") def testAuthor(self): @@ -309,22 +309,22 @@ # Assert that each element in the feed author list is an atom.Author for an_author in self.calendar_event_feed.author: - self.assert_(isinstance(an_author, atom.Author), + self.assertTrue(isinstance(an_author, atom.Author), "Calendar event feed element must be an instance of " + "atom.Author: %s" % an_author) # Assert the feed author name is as expected - self.assertEquals(self.calendar_event_feed.author[0].name.text, + self.assertEqual(self.calendar_event_feed.author[0].name.text, 'GData Ops Demo') # Assert the feed author name is as expected - self.assertEquals(self.calendar_event_feed.author[0].email.text, + self.assertEqual(self.calendar_event_feed.author[0].email.text, 'gdata.ops.demo@gmail.com') # Assert one of the values for an entry author - self.assertEquals(self.calendar_event_feed.entry[0].author[0].name.text, + self.assertEqual(self.calendar_event_feed.entry[0].author[0].name.text, 'GData Ops Demo') - self.assertEquals(self.calendar_event_feed.entry[0].author[0].email.text, + self.assertEqual(self.calendar_event_feed.entry[0].author[0].email.text, 'gdata.ops.demo@gmail.com') def testId(self): @@ -332,22 +332,22 @@ verifies the value""" # Assert the feed id exists and is an atom.Id - self.assert_(isinstance(self.calendar_event_feed.id, atom.Id), + self.assertTrue(isinstance(self.calendar_event_feed.id, atom.Id), "Calendar event feed element must be an instance of " + "atom.Id: %s" % self.calendar_event_feed.id) # Assert the feed id value is as expected - self.assertEquals(self.calendar_event_feed.id.text, + self.assertEqual(self.calendar_event_feed.id.text, 'http://www.google.com/calendar/feeds/default/private/full') # Assert that each entry has an id which is an atom.Id for an_entry in self.calendar_event_feed.entry: - self.assert_(isinstance(an_entry.id, atom.Id), + self.assertTrue(isinstance(an_entry.id, atom.Id), "Calendar event entry element must be an " + "instance of atom.Id: %s" % an_entry.id) # Assert one of the values for an id - self.assertEquals(self.calendar_event_feed.entry[1].id.text, + self.assertEqual(self.calendar_event_feed.entry[1].id.text, 'http://www.google.com/calendar/feeds/default/private/full/' + '2qt3ao5hbaq7m9igr5ak9esjo0') @@ -357,12 +357,12 @@ # Assert that each entry has a published value which is an atom.Published for an_entry in self.calendar_event_feed.entry: - self.assert_(isinstance(an_entry.published, atom.Published), + self.assertTrue(isinstance(an_entry.published, atom.Published), "Calendar event entry element must be an instance " + "of atom.Published: %s" % an_entry.published) # Assert one of the values for published is as expected - self.assertEquals(self.calendar_event_feed.entry[1].published.text, + self.assertEqual(self.calendar_event_feed.entry[1].published.text, '2007-03-20T21:26:04.000Z') def testUpdated(self): @@ -370,22 +370,22 @@ verifies the value""" # Assert that the feed updated element exists and is an atom.Updated - self.assert_(isinstance(self.calendar_event_feed.updated, atom.Updated), + self.assertTrue(isinstance(self.calendar_event_feed.updated, atom.Updated), "Calendar feed element must be an instance of " + "atom.Updated: %s" % self.calendar_event_feed.updated) # Assert that each entry has a updated value which is an atom.Updated for an_entry in self.calendar_event_feed.entry: - self.assert_(isinstance(an_entry.updated, atom.Updated), + self.assertTrue(isinstance(an_entry.updated, atom.Updated), "Calendar event entry element must be an instance " + "of atom.Updated: %s" % an_entry.updated) # Assert the feed updated value is as expected - self.assertEquals(self.calendar_event_feed.updated.text, + self.assertEqual(self.calendar_event_feed.updated.text, '2007-03-20T21:29:57.000Z') # Assert one of the values for updated - self.assertEquals(self.calendar_event_feed.entry[3].updated.text, + self.assertEqual(self.calendar_event_feed.entry[3].updated.text, '2007-03-20T21:25:46.000Z') def testTitle(self): @@ -393,21 +393,21 @@ and verifies the value""" # Assert that the feed title element exists and is an atom.Title - self.assert_(isinstance(self.calendar_event_feed.title, atom.Title), + self.assertTrue(isinstance(self.calendar_event_feed.title, atom.Title), "Calendar feed element must be an instance of " + "atom.Title: %s" % self.calendar_event_feed.title) # Assert that each entry has a title value which is an atom.Title for an_entry in self.calendar_event_feed.entry: - self.assert_(isinstance(an_entry.title, atom.Title), + self.assertTrue(isinstance(an_entry.title, atom.Title), "Calendar event entry element must be an instance of " + "atom.Title: %s" % an_entry.title) # Assert the feed title value is as expected - self.assertEquals(self.calendar_event_feed.title.text, 'GData Ops Demo') + self.assertEqual(self.calendar_event_feed.title.text, 'GData Ops Demo') # Assert one of the values for title - self.assertEquals(self.calendar_event_feed.entry[0].title.text, + self.assertEqual(self.calendar_event_feed.entry[0].title.text, 'test deleted') def testPostLink(self): @@ -416,15 +416,15 @@ # Assert that each link in the feed is an atom.Link for a_link in self.calendar_event_feed.link: - self.assert_(isinstance(a_link, atom.Link), + self.assertTrue(isinstance(a_link, atom.Link), "Calendar event entry element must be an instance of " + "atom.Link: %s" % a_link) # Assert post link exists - self.assert_(self.calendar_event_feed.GetPostLink() is not None) + self.assertTrue(self.calendar_event_feed.GetPostLink() is not None) # Assert the post link value is as expected - self.assertEquals(self.calendar_event_feed.GetPostLink().href, + self.assertEqual(self.calendar_event_feed.GetPostLink().href, 'http://www.google.com/calendar/feeds/default/private/full') def testEditLink(self): @@ -433,19 +433,19 @@ # Assert that each link in the feed is an atom.Link for a_link in self.calendar_event_feed.link: - self.assert_(isinstance(a_link, atom.Link), + self.assertTrue(isinstance(a_link, atom.Link), "Calendar event entry element must be an instance of " + "atom.Link: %s" % a_link) # Assert edit link exists for a_entry in self.calendar_event_feed.entry: - self.assert_(a_entry.GetEditLink() is not None) + self.assertTrue(a_entry.GetEditLink() is not None) # Assert the edit link value is as expected - self.assertEquals(self.calendar_event_feed.entry[0].GetEditLink().href, + self.assertEqual(self.calendar_event_feed.entry[0].GetEditLink().href, 'http://www.google.com/calendar/feeds/default/private/full/o99flmgm' + 'kfkfrr8u745ghr3100/63310109397') - self.assertEquals(self.calendar_event_feed.entry[0].GetEditLink().type, + self.assertEqual(self.calendar_event_feed.entry[0].GetEditLink().type, 'application/atom+xml') def testOpenSearch(self): @@ -453,40 +453,40 @@ , """ # Assert that the elements exist and are the appropriate type - self.assert_(isinstance(self.calendar_event_feed.total_results, + self.assertTrue(isinstance(self.calendar_event_feed.total_results, gdata.TotalResults), "Calendar event feed element must be an " + "instance of gdata.TotalResults: %s" % ( self.calendar_event_feed.total_results)) - self.assert_( + self.assertTrue( isinstance(self.calendar_event_feed.start_index, gdata.StartIndex), "Calendar event feed element must be an " + "instance of gdata.StartIndex: %s" % ( self.calendar_event_feed.start_index)) - self.assert_( + self.assertTrue( isinstance(self.calendar_event_feed.items_per_page, gdata.ItemsPerPage), "Calendar event feed element must be an " + "instance of gdata.ItemsPerPage: %s" % ( self.calendar_event_feed.items_per_page)) # Assert the values for each openSearch element are as expected - self.assertEquals(self.calendar_event_feed.total_results.text, '10') - self.assertEquals(self.calendar_event_feed.start_index.text, '1') - self.assertEquals(self.calendar_event_feed.items_per_page.text, '25') + self.assertEqual(self.calendar_event_feed.total_results.text, '10') + self.assertEqual(self.calendar_event_feed.start_index.text, '1') + self.assertEqual(self.calendar_event_feed.items_per_page.text, '25') def testGenerator(self): """Tests the existence of and verifies the value""" # Assert that the element exists and is of the appropriate type - self.assert_(isinstance(self.calendar_event_feed.generator, atom.Generator), + self.assertTrue(isinstance(self.calendar_event_feed.generator, atom.Generator), "Calendar event feed element must be an instance " + "of atom.Generator: %s" % self.calendar_event_feed.generator) # Assert the generator version, uri and text are as expected - self.assertEquals(self.calendar_event_feed.generator.text, + self.assertEqual(self.calendar_event_feed.generator.text, 'Google Calendar') - self.assertEquals(self.calendar_event_feed.generator.version, '1.0') - self.assertEquals(self.calendar_event_feed.generator.uri, + self.assertEqual(self.calendar_event_feed.generator.version, '1.0') + self.assertEqual(self.calendar_event_feed.generator.uri, 'http://www.google.com/calendar') def testCategory(self): @@ -494,22 +494,22 @@ # Assert that the element exists and is of the appropriate type and value for a_category in self.calendar_event_feed.category: - self.assert_(isinstance(a_category, atom.Category), + self.assertTrue(isinstance(a_category, atom.Category), "Calendar event feed element must be an instance " + "of atom.Category: %s" % a_category) - self.assertEquals(a_category.scheme, + self.assertEqual(a_category.scheme, 'http://schemas.google.com/g/2005#kind') - self.assertEquals(a_category.term, + self.assertEqual(a_category.term, 'http://schemas.google.com/g/2005#event') for an_event in self.calendar_event_feed.entry: for a_category in an_event.category: - self.assert_(isinstance(a_category, atom.Category), + self.assertTrue(isinstance(a_category, atom.Category), "Calendar event feed entry element must be an " + "instance of atom.Category: %s" % a_category) - self.assertEquals(a_category.scheme, + self.assertEqual(a_category.scheme, 'http://schemas.google.com/g/2005#kind') - self.assertEquals(a_category.term, + self.assertEqual(a_category.term, 'http://schemas.google.com/g/2005#event') @@ -519,18 +519,18 @@ # Assert that the element exists and is of the appropriate type and value for an_event in self.calendar_event_feed.entry: - self.assert_(isinstance(an_event.send_event_notifications, + self.assertTrue(isinstance(an_event.send_event_notifications, gdata.calendar.SendEventNotifications), ("Calendar event feed entry element " + "must be an instance of gdata.calendar.SendEventNotifications: %s") % ( an_event.send_event_notifications,)) # Assert the are as expected - self.assertEquals( + self.assertEqual( self.calendar_event_feed.entry[0].send_event_notifications.value, 'false') - self.assertEquals( + self.assertEqual( self.calendar_event_feed.entry[2].send_event_notifications.value, 'true') @@ -543,8 +543,8 @@ unmarshalled_entry = entry.ToString() tag = '{%s}quickadd' % (gdata.calendar.GCAL_NAMESPACE) marshalled_entry = ElementTree.fromstring(unmarshalled_entry).find(tag) - self.assert_(marshalled_entry.attrib['value'],'true') - self.assert_(marshalled_entry.tag,tag) + self.assertTrue(marshalled_entry.attrib['value'],'true') + self.assertTrue(marshalled_entry.tag,tag) def testEventStatus(self): """Test the existence of @@ -552,18 +552,18 @@ # Assert that the element exists and is of the appropriate type and value for an_event in self.calendar_event_feed.entry: - self.assert_(isinstance(an_event.event_status, + self.assertTrue(isinstance(an_event.event_status, gdata.calendar.EventStatus), ("Calendar event feed entry element " + "must be an instance of gdata.calendar.EventStatus: %s") % ( an_event.event_status,)) # Assert the are as expected - self.assertEquals( + self.assertEqual( self.calendar_event_feed.entry[0].event_status.value, 'CANCELED') - self.assertEquals( + self.assertEqual( self.calendar_event_feed.entry[1].event_status.value, 'CONFIRMED') @@ -572,7 +572,7 @@ # Assert that the element exists and is of the appropriate type and value for an_event in self.calendar_event_feed.entry: - self.assert_(an_event.comments is None or isinstance(an_event.comments, + self.assertTrue(an_event.comments is None or isinstance(an_event.comments, gdata.calendar.Comments), ("Calendar event feed entry element " + "must be an instance of gdata.calendar.Comments: %s") % ( @@ -583,22 +583,22 @@ # Assert that the element exists and is of the appropriate type and value for an_event in self.calendar_event_feed.entry: - self.assert_(isinstance(an_event.visibility, + self.assertTrue(isinstance(an_event.visibility, gdata.calendar.Visibility), ("Calendar event feed entry element " + "must be an instance of gdata.calendar.Visibility: %s") % ( an_event.visibility,)) # Assert the are as expected - self.assertEquals( + self.assertEqual( self.calendar_event_feed.entry[0].visibility.value, 'DEFAULT') - self.assertEquals( + self.assertEqual( self.calendar_event_feed.entry[1].visibility.value, 'PRIVATE') - self.assertEquals( + self.assertEqual( self.calendar_event_feed.entry[2].visibility.value, 'PUBLIC') @@ -607,22 +607,22 @@ # Assert that the element exists and is of the appropriate type and value for an_event in self.calendar_event_feed.entry: - self.assert_(isinstance(an_event.transparency, + self.assertTrue(isinstance(an_event.transparency, gdata.calendar.Transparency), ("Calendar event feed entry element " + "must be an instance of gdata.calendar.Transparency: %s") % ( an_event.transparency,)) # Assert the are as expected - self.assertEquals( + self.assertEqual( self.calendar_event_feed.entry[0].transparency.value, 'OPAQUE') - self.assertEquals( + self.assertEqual( self.calendar_event_feed.entry[1].transparency.value, 'OPAQUE') - self.assertEquals( + self.assertEqual( self.calendar_event_feed.entry[2].transparency.value, 'OPAQUE') @@ -635,12 +635,12 @@ # Assert that each entry has a where value which is an gdata.calendar.Where for an_entry in self.calendar_event_feed.entry: for a_where in an_entry.where: - self.assert_(isinstance(a_where, gdata.calendar.Where), + self.assertTrue(isinstance(a_where, gdata.calendar.Where), "Calendar event entry element must be an instance of " + "gdata.calendar.Where: %s" % a_where) # Assert one of the values for where is as expected - self.assertEquals(self.calendar_event_feed.entry[1].where[0].value_string, + self.assertEqual(self.calendar_event_feed.entry[1].where[0].value_string, 'Dolores Park with Kim') def testWhenAndReminder(self): @@ -651,46 +651,46 @@ # Assert that each reminder is a gdata.calendar.Reminder for an_entry in self.calendar_event_feed.entry: for a_when in an_entry.when: - self.assert_(isinstance(a_when, gdata.calendar.When), + self.assertTrue(isinstance(a_when, gdata.calendar.When), "Calendar event entry element must be an instance " + "of gdata.calendar.When: %s" % a_when) for a_reminder in a_when.reminder: - self.assert_(isinstance(a_reminder, gdata.calendar.Reminder), + self.assertTrue(isinstance(a_reminder, gdata.calendar.Reminder), "Calendar event entry element must be an " + "instance of gdata.calendar.Reminder: %s" % a_reminder) # Assert one of the values for when is as expected - self.assertEquals(self.calendar_event_feed.entry[0].when[0].start_time, + self.assertEqual(self.calendar_event_feed.entry[0].when[0].start_time, '2007-03-23T12:00:00.000-07:00') - self.assertEquals(self.calendar_event_feed.entry[0].when[0].end_time, + self.assertEqual(self.calendar_event_feed.entry[0].when[0].end_time, '2007-03-23T13:00:00.000-07:00') # Assert the reminder child of when is as expected - self.assertEquals( + self.assertEqual( self.calendar_event_feed.entry[0].when[0].reminder[0].minutes, '10') - self.assertEquals( + self.assertEqual( self.calendar_event_feed.entry[1].when[0].reminder[0].minutes, '20') def testBatchRequestParsing(self): batch_request = gdata.calendar.CalendarEventFeedFromString( test_data.CALENDAR_BATCH_REQUEST) - self.assertEquals(len(batch_request.entry), 4) + self.assertEqual(len(batch_request.entry), 4) # Iterate over the batch request entries and match the operation with # the batch id. These values are hard coded to match the test data. for entry in batch_request.entry: if entry.batch_id.text == '1': - self.assertEquals(entry.batch_operation.type, 'insert') + self.assertEqual(entry.batch_operation.type, 'insert') if entry.batch_id.text == '2': - self.assertEquals(entry.batch_operation.type, 'query') + self.assertEqual(entry.batch_operation.type, 'query') if entry.batch_id.text == '3': - self.assertEquals(entry.batch_operation.type, 'update') - self.assertEquals(entry.title.text, 'Event updated via batch') + self.assertEqual(entry.batch_operation.type, 'update') + self.assertEqual(entry.title.text, 'Event updated via batch') if entry.batch_id.text == '4': - self.assertEquals(entry.batch_operation.type, 'delete') - self.assertEquals(entry.id.text, + self.assertEqual(entry.batch_operation.type, 'delete') + self.assertEqual(entry.id.text, 'http://www.google.com/calendar/feeds/default/' 'private/full/d8qbg9egk1n6lhsgq1sjbqffqc') - self.assertEquals(entry.GetEditLink().href, + self.assertEqual(entry.GetEditLink().href, 'http://www.google.com/calendar/feeds/default/' 'private/full/d8qbg9egk1n6lhsgq1sjbqffqc/' '63326018324') @@ -698,22 +698,22 @@ def testBatchResponseParsing(self): batch_response = gdata.calendar.CalendarEventFeedFromString( test_data.CALENDAR_BATCH_RESPONSE) - self.assertEquals(len(batch_response.entry), 4) + self.assertEqual(len(batch_response.entry), 4) for entry in batch_response.entry: if entry.batch_id.text == '1': - self.assertEquals(entry.batch_operation.type, 'insert') - self.assertEquals(entry.batch_status.code, '201') - self.assertEquals(entry.batch_status.reason, 'Created') - self.assertEquals(entry.id.text, 'http://www.google.com/calendar/' + self.assertEqual(entry.batch_operation.type, 'insert') + self.assertEqual(entry.batch_status.code, '201') + self.assertEqual(entry.batch_status.reason, 'Created') + self.assertEqual(entry.id.text, 'http://www.google.com/calendar/' 'feeds/default/private/full/' 'n9ug78gd9tv53ppn4hdjvk68ek') if entry.batch_id.text == '2': - self.assertEquals(entry.batch_operation.type, 'query') + self.assertEqual(entry.batch_operation.type, 'query') if entry.batch_id.text == '3': - self.assertEquals(entry.batch_operation.type, 'update') + self.assertEqual(entry.batch_operation.type, 'update') if entry.batch_id.text == '4': - self.assertEquals(entry.batch_operation.type, 'delete') - self.assertEquals(entry.id.text, 'http://www.google.com/calendar/' + self.assertEqual(entry.batch_operation.type, 'delete') + self.assertEqual(entry.id.text, 'http://www.google.com/calendar/' 'feeds/default/private/full/' 'd8qbg9egk1n6lhsgq1sjbqffqc') @@ -834,11 +834,11 @@ """Asserts that the web content link is the correct type and contains the expected values""" - self.assert_(isinstance(web_content_link, gdata.calendar.WebContentLink), + self.assertTrue(isinstance(web_content_link, gdata.calendar.WebContentLink), "Web content link element must be an " + "instance of gdata.calendar.WebContentLink: %s" % web_content_link) expected_rel = '%s/%s' % (gdata.calendar.GCAL_NAMESPACE, 'webContent') - self.assertEquals(expected_rel, web_content_link.rel) + self.assertEqual(expected_rel, web_content_link.rel) self.assertEquaRefactoringTool: Refactored ./tests/gdata_tests/calendar_resource/live_client_test.py l(expected_title, web_content_link.title) self.assertEqual(expected_href, web_content_link.href) self.assertEqual(expected_type, web_content_link.type) @@ -848,12 +848,12 @@ """Asserts that the web content element is the correct type and contains the expected values""" - self.assert_(isinstance(web_content_element, gdata.calendar.WebContent), + self.assertTrue(isinstance(web_content_element, gdata.calendar.WebContent), "Calendar event entry element must be an " + "instance of gdata.calendar.WebContent: %s" % web_content_element) - self.assertEquals(expected_width, web_content_element.width) - self.assertEquals(expected_height, web_content_element.height) - self.assertEquals(expected_url, web_content_element.url) + self.assertEqual(expected_width, web_content_element.width) + self.assertEqual(expected_height, web_content_element.height) + self.assertEqual(expected_url, web_content_element.url) def assertValidWebContentGadget(self, expected_url=None, expected_width=None, expected_height=None, expected_pref_name=None, expected_pref_value=None, @@ -861,15 +861,15 @@ """Asserts that the web content element is the correct type and contains the expected values""" - self.assert_(isinstance(web_content_element, gdata.calendar.WebContent), + self.assertTrue(isinstance(web_content_element, gdata.calendar.WebContent), "Calendar event entry element must be an " + "instance of gdata.calendar.WebContent: %s" % web_content_element) - self.assertEquals(expected_width, web_content_element.width) - self.assertEquals(expected_height, web_content_element.height) - self.assertEquals(expected_url, web_content_element.url) - self.assertEquals(expected_pref_name, + self.assertEqual(expected_width, web_content_element.width) + self.assertEqual(expected_height, web_content_element.height) + self.assertEqual(expected_url, web_content_element.url) + self.assertEqual(expected_pref_name, web_content_element.gadget_pref[0].name) - self.assertEquals(expected_pref_value, + self.assertEqual(expected_pref_value, web_content_element.gadget_pref[0].value) def testSampleCode(self): @@ -898,8 +898,8 @@ ep.value = 'val' xml_string = ep.ToString() ep2 = gdata.ExtendedPropertyFromString(xml_string) - self.assertEquals(ep.name, ep2.name) - self.assertEquals(ep.value, ep2.value) + self.assertEqual(ep.name, ep2.name) + self.assertEqual(ep.value, ep2.value) if __name__ == '__main__': --- ./tests/gdata_tests/calendar_resource/live_client_test.py (original) +++ ./tests/gdata_tests/calendar_resource/live_client_test.py (refactored) @@ -85,8 +85,8 @@ 'CR-NYC-14-12-BR', 'Boardroom', ('This conference room is in New York City, building 14, floor 12, ' 'Boardroom'), 'CR') - except Exception, e: - print e + except Exception as e: + print(e) self.client.delete_resource('CR-NYC-14-12-BR') # If the test failed to run to completion # the resource may already exist @@ -95,7 +95,7 @@ ('This conference room is in New York City, building 14, floor 12, ' 'Boardroom'), 'CR') - self.assert_(isinstance(new_entry, + self.assertTrue(isinstance(new_entry, gdata.calendar_resource.data.CalendarResourceEntry)) self.assertEqual(new_entry.resource_id, 'CR-NYC-14-12-BR') self.assertEqual(new_entry.resource_common_name, 'Boardroom') @@ -105,7 +105,7 @@ self.assertEqual(new_entry.resource_type, 'CR') fetched_entry = self.client.get_resource(resource_id='CR-NYC-14-12-BR') - self.assert_(isinstance(fetched_entry, + self.assertTrue(isinstance(fetched_entry, gdata.calendar_resource.data.CalendarResourceEntry)) self.assertEqual(fetched_entry.resource_id, 'CR-NYC-14-12-BR') self.assertEqual(fetched_entry.resource_common_name, 'Boardroom') @@ -119,7 +119,7 @@ new_entry.resource_description = 'ThisRefactoringTool: Refactored ./tests/gdata_tests/calendar_resource/data_test.py RefactoringTool: Refactored ./tests/gdata_tests/calendar/service_test.py conference room is in Mountain View' new_entry.resource_type = 'BR' updated_entry = self.client.update(new_entry) - self.assert_(isinstance(updated_entry, + self.assertTrue(isinstance(updated_entry, gdata.calendar_resource.data.CalendarResourceEntry)) self.assertEqual(updated_entry.resource_id, 'CR-MTV-14-12-BR') self.assertEqual(updated_entry.resource_common_name, 'Executive Boardroom') --- ./tests/gdata_tests/calendar_resource/data_test.py (original) +++ ./tests/gdata_tests/calendar_resource/data_test.py (refactored) @@ -34,39 +34,39 @@ gdata.calendar_resource.data.CalendarResourceFeed) def testCalendarResourceEntryFromString(self): - self.assert_(isinstance(self.entry, + self.assertTrue(isinstance(self.entry, gdata.calendar_resource.data.CalendarResourceEntry)) - self.assertEquals(self.entry.resource_id, 'CR-NYC-14-12-BR') - self.assertEquals(self.entry.resource_common_name, 'Boardroom') - self.assertEquals(self.entry.resource_description, + self.assertEqual(self.entry.resource_id, 'CR-NYC-14-12-BR') + self.assertEqual(self.entry.resource_common_name, 'Boardroom') + self.assertEqual(self.entry.resource_description, ('This conference room is in New York City, building 14, floor 12, ' 'Boardroom')) - self.assertEquals(self.entry.resource_type, 'CR') + self.assertEqual(self.entry.resource_type, 'CR') def testCalendarResourceFeedFromString(self): - self.assertEquals(len(self.feed.entry), 2) - self.assert_(isinstance(self.feed, + self.assertEqual(len(self.feed.entry), 2) + self.assertTrue(isinstance(self.feed, gdata.calendar_resource.data.CalendarResourceFeed)) - self.assert_(isinstance(self.feed.entry[0], + self.assertTrue(isinstance(self.feed.entry[0], gdata.calendar_resource.data.CalendarResourceEntry)) - self.assert_(isinstance(self.feed.entry[1], + self.assertTrue(isinstance(self.feed.entry[1], gdata.calendar_resource.data.CalendarResourceEntry)) - self.assertEquals( + self.assertEqual( self.feed.entry[0].find_edit_link(), 'https://apps-apis.google.com/feeds/calendar/resource/2.0/yourdomain.com/CR-NYC-14-12-BR') - self.assertEquals(self.feed.entry[0].resource_id, 'CR-NYC-14-12-BR') - self.assertEquals(self.feed.entry[0].resource_common_name, 'Boardroom') - self.assertEquals(self.feed.entry[0].resource_description, + self.assertEqual(self.feed.entry[0].resource_id, 'CR-NYC-14-12-BR') + self.assertEqual(self.feed.entry[0].resource_common_name, 'Boardroom') + self.assertEqual(self.feed.entry[0].resource_description, ('This conference room is in New York City, building 14, floor 12, ' 'Boardroom')) - self.assertEquals(self.feed.entry[0].resource_type, 'CR') - self.assertEquals(self.feed.entry[1].resource_id, + self.assertEqual(self.feed.entry[0].resource_type, 'CR') + self.assertEqual(self.feed.entry[1].resource_id, '(Bike)-London-43-Lobby-Bike-1') - self.assertEquals(self.feed.entry[1].resource_common_name, 'London bike-1') - self.assertEquals(self.feed.entry[1].resource_description, + self.assertEqual(self.feed.entry[1].resource_common_name, 'London bike-1') + self.assertEqual(self.feed.entry[1].resource_description, 'Bike is in London at building 43\'s lobby.') - self.assertEquals(self.feed.entry[1].resource_type, '(Bike)') - self.assertEquals( + self.assertEqual(self.feed.entry[1].resource_type, '(Bike)') + self.assertEqual( self.feed.entry[1].find_edit_link(), 'https://apps-apis.google.com/a/feeds/calendar/resource/2.0/yourdomain.com/(Bike)-London-43-Lobby-Bike-1') --- ./tests/gdata_tests/calendar/service_test.py (original) +++ ./tests/gdata_tests/calendar/service_test.py (refactored) @@ -46,11 +46,11 @@ pass def testUrlScrubbing(self): - self.assertEquals(self.cal_client._RemoveStandardUrlPrefix( + self.assertEqual(self.cal_client._RemoveStandardUrlPrefix( '/test'), '/test') - self.assertEquals(self.cal_client._RemoveStandardUrlPrefix( + self.assertEqual(self.cal_client._RemoveStandardUrlPrefix( 'http://www.google.com/calendar/test'), '/calendar/test') - self.assertEquals(self.cal_client._RemoveStandardUrlPrefix( + self.assertEqual(self.cal_client._RemoveStandardUrlPrefix( 'https://www.google.com/calendar/test'), 'https://www.google.com/calendar/test') @@ -67,22 +67,22 @@ calendar = gdata.calendar.CalendarListEntry() calendar.id = atom.Id(text=subscription_id) returned_calendar = self.cal_client.InsertCalendarSubscription(calendar) - self.assertEquals(subscription_url, returned_calendar.id.text) - self.assertEquals('Google Doodles', returned_calendar.title.text) + self.assertEqual(subscription_url, returned_calendar.id.text) + self.assertEqual('Google Doodles', returned_calendar.title.text) # Update subscription calendar_to_update = self.cal_client.GetCalendarListEntry(subscription_url) - self.assertEquals('Google Doodles', calendar_to_update.title.text) - self.assertEquals('true', calendar_to_update.selected.value) + self.assertEqual('Google Doodles', calendar_to_update.title.text) + self.assertEqual('true', calendar_to_update.selected.value) calendar_to_update.selected.value = 'false' - self.assertEquals('false', calendar_to_update.selected.value) + self.assertEqual('false', calendar_to_update.selected.value) updated_calendar = self.cal_client.UpdateCalendar(calendar_to_update) - self.assertEquals('false', updated_calendar.selected.value) + self.assertEqual('false', updated_calendar.selected.value) # Delete subscription response = self.cal_client.DeleteCalendarEntry( returned_calendar.GetEditLink().href) - self.assertEquals(True, response) + self.assertEqual(True, response) def testPostUpdateAndDeleteCalendar(self): """Test posting a new calendar, updating it, deleting it""" @@ -110,15 +110,15 @@ # Create calendar new_calendar = self.cal_client.InsertCalendar(new_calendar=calendar) - self.assertEquals(title, new_calendar.title.text) - self.assertEquals(description, new_calendar.summary.text) - self.assertEquals(location, new_calendar.where.value_string) - self.assertEquals(color, new_calendar.color.value) - self.assertEquals(time_zone, new_calendar.timezone.value) + self.assertEqual(title, new_calendar.title.text) + self.assertEqual(description, new_calendar.summary.text) + self.assertEqual(location, new_calendar.where.value_string) + self.assertEqual(color, new_calendar.color.value) + self.assertEqual(time_zone, new_calendar.timezone.value) if hidden: - self.assertEquals('true', new_calendar.hidden.value) + self.assertEqual('true', new_calendar.hidden.value) else: - self.assertEquals('false', new_calendar.hidden.value) + self.assertEqual('false', new_calendar.hidden.value) # Update calendar calendar_to_update = self.cal_client.GetCalendarListEntry( @@ -126,7 +126,7 @@ updated_title = 'This is the updated title' calendar_to_update.title.text = updated_title updated_calendar = self.cal_client.UpdateCalendar(calendar_to_update) - self.assertEquals(updated_title, updated_calendar.title.text) + self.assertEqual(updated_title, updated_calendar.title.text) # Delete calendar calendar_to_delete = self.cal_client.GetCalendarListEntry( @@ -157,7 +157,7 @@ new_event = self.cal_client.InsertEvent(event, '/calendar/feeds/default/private/full') - self.assertEquals(event.extended_property[0].value, + self.assertEqual(event.extended_property[0].value, new_event.extended_property[0].value) # Delete the event @@ -239,11 +239,11 @@ '/calendar/feeds/default/private/full') # Ensure that atom data returned from calendar server equals atom data sent - self.assertEquals(event.title.text, new_event.title.text) - self.assertEquals(event.content.text, new_event.content.text) + self.assertEqual(event.title.text, new_event.title.text) + self.assertEqual(event.content.text, new_event.content.text) # Ensure that gd:where data returned from calendar equals value sent - self.assertEquals(event.where[0].value_string, + self.assertEqual(event.where[0].value_string, new_event.where[0].value_string) # Commented out as dateutil is not in this repository @@ -265,7 +265,7 @@ event_to_update.GetEditLink().href, event_to_update) # Ensure that updated title was set in the updated event - self.assertEquals(event_to_update.title.text, updated_event.title.text) + self.assertEqual(event_to_update.title.text, updated_event.title.text) # Delete the event self.cal_client.DeleteEvent(updated_event.GetEditLink().href) @@ -279,11 +279,11 @@ after_delete_query) # Ensure feed returned at max after_delete_query.max_results events - self.assert_( + self.assertTrue( len(after_delete_query_result.entry) <= after_delete_query.max_results) # Ensure status of returned event is canceled - self.assertEquals(after_delete_query_result.entry[0].event_status.value, + self.assertEqual(after_delete_query_result.entry[0].event_status.value, 'CANCELED') def testEventWithSyncEventAndUID(self): @@ -313,7 +313,7 @@ # the format doesn't seem to be important per the RFC except for being # globally unique. uid_string = '' - for i in xrange(121): + for i in range(121): uid_string += "%X" % r.randint(0, 0xf) # Set event data @@ -337,7 +337,7 @@ bad_event = self.cal_client.InsertEvent(event, '/calendar/feeds/default/private/full') self.fail('Was able to insert an event with a duplicate UID') - except gdata.service.RequestError, error: + except gdata.service.RequestError as error: # for the current problem with redirects, just re-raise so the # failure doesn't seem to be because of the duplicate UIDs. status = error[0]['status'] @@ -345,16 +345,16 @@ raise # otherwise, make sure it was the right error - self.assertEquals(error[0]['status'], 409) - self.assertEquals(error[0]['reason'], 'Conflict') + self.assertEqual(error[0]['status'], 409) + self.assertEqual(error[0]['reason'], 'Conflict') # Ensure that atom data returned from calendar server equals atom data # sent - self.assertEquals(event.title.text, new_event.title.text) - self.assertEquals(event.content.text, new_event.content.text) + self.assertEqual(event.title.text, new_event.title.text) + self.assertEqual(event.content.text, new_event.content.text) # Ensure that gd:where data returned from calendar equals value sent - self.assertEquals(event.where[0].value_string, + self.assertEqual(event.where[0].value_string, new_event.where[0].value_string) # Delete the event @@ -384,11 +384,11 @@ batch_result = self.cal_client.ExecuteBatch(batch_request, gdata.calendar.service.DEFAULT_BATCH_URL) - self.assertEquals(len(batch_result.entry), 1) - self.assertEquals(batch_result.entry[0].title.text, random_event_title) - self.assertEquals(batch_result.entry[0].batch_operation.type, + self.assertEqual(len(batch_result.entry), 1) + self.assertEqual(batch_result.entry[0].title.text, random_event_title) + self.assertEqual(batch_result.entry[0].batch_operation.type, gdata.BATCH_INSERT) - self.assertEquals(batch_result.GetBatchLink().href, + self.assertEqual(batch_result.GetBatchLink().href, gdata.calendar.service.DEFAULT_BATCH_URL) # Create a batch request to delete the newly created entry. @@ -397,15 +397,15 @@ batch_delete_result = self.cal_client.ExecuteBatch(batch_delete_request, batch_result.GetBatchLink().href) - self.assertEquals(len(batch_delete_result.entry), 1) - self.assertEquals(batch_delete_result.entry[0].batch_operation.type, + self.assertEqual(len(batch_delete_result.entry), 1) + selRefactoringTool: Refactored ./tests/gdata_tests/calendar/calendar_acl_test.py f.assertEqual(batch_delete_result.entry[0].batch_operation.type, gdata.BATCH_DELETE) def testCorrectReturnTypesForGetMethods(self): self.cal_client.ProgrammaticLogin() result = self.cal_client.GetCalendarEventFeed() - self.assertEquals(isinstance(result, gdata.calendar.CalendarEventFeed), + self.assertEqual(isinstance(result, gdata.calendar.CalendarEventFeed), True) def testValidHostName(self): @@ -417,11 +417,11 @@ self.cal_client.ssl = True self.cal_client.http_client = mock_http self.cal_client.SetAuthSubToken('foo') - self.assertEquals(str(self.cal_client.token_store.find_token( + self.assertEqual(str(self.cal_client.token_store.find_token( 'https://www.google.com/calendar/feeds/default/allcalendars/full')), 'AuthSub token=foo') resp = self.cal_client.Get('/calendar/feeds/default/allcalendars/full') - self.assert_(resp is not None) + self.assertTrue(resp is not None) class CalendarEventQueryUnitTest(unittest.TestCase): @@ -431,31 +431,31 @@ def testOrderByValidatesValues(self): self.query.orderby = 'lastmodified' - self.assertEquals(self.query.orderby, 'lastmodified') + self.assertEqual(self.query.orderby, 'lastmodified') try: self.query.orderby = 'illegal input' self.fail() except gdata.calendar.service.Error: - self.assertEquals(self.query.orderby, 'lastmodified') + self.assertEqual(self.query.orderby, 'lastmodified') def testSortOrderValidatesValues(self): self.query.sortorder = 'a' - self.assertEquals(self.query.sortorder, 'a') + self.assertEqual(self.query.sortorder, 'a') try: self.query.sortorder = 'illegal input' self.fail() except gdata.calendar.service.Error: - self.assertEquals(self.query.sortorder, 'a') + self.assertEqual(self.query.sortorder, 'a') def testTimezoneParameter(self): self.query.ctz = 'America/Los_Angeles' - self.assertEquals(self.query['ctz'], 'America/Los_Angeles') - self.assert_(self.query.ToUri().find('America%2FLos_Angeles') > -1) + self.assertEqual(self.query['ctz'], 'America/Los_Angeles') + self.assertTrue(self.query.ToUri().find('America%2FLos_Angeles') > -1) if __name__ == '__main__': print ('Google Calendar Test\nNOTE: Please run these tests only with a ' 'test account. The tests may delete or update your data.') - username = raw_input('Please enter your username: ') + username = input('Please enter your username: ') password = getpass.getpass() unittest.main() --- ./tests/gdata_tests/calendar/calendar_acl_test.py (original) +++ ./tests/gdata_tests/calendar/calendar_acl_test.py (refactored) @@ -73,7 +73,7 @@ try: self.cal_client.GetCalendarAclFeed(self._aclFeedUri) self.fail("Unauthenticated request should fail") - except gdata.service.RequestError, error: + except gdata.service.RequestError as error: self.assertEqual(error[0]['status'], 401) self.assertEqual(error[0]['reason'], "Authorization required") @@ -88,7 +88,7 @@ try: self.cal_client.GetCalendarAclEntry(self._aclEntryUri) self.fail("Unauthenticated request should fail"); - except gdata.service.RequestError, error: + except gdata.service.RequestError as error: self.assertEqual(error[0]['status'], 401) self.assertEqual(error[0]['reason'], "Authorization required") @@ -131,7 +131,7 @@ # Delete the event self.cal_client.DeleteAclEntry(returned_rule.GetEditLink().href) aclFeed = self.cal_client.GetCalendarAclFeed(self._aclFeedUri) - self.assertEquals(original_rule_count, len(aclFeed.entry)) + self.assertEqual(original_rule_count, len(aclFeed.entry)) def testUpdateAclChangeScopeValue(self): """Fiendishly try to insert a test ACL rule and attempt to change the scope value (i.e. username). @@ -147,7 +147,7 @@ updated_rule.scope.value = "user_%s@gmail.com" % (self._getRandomNumber()) try: returned_rule = self.cal_client.UpdRefactoringTool: Refactored ./tests/gdata_tests/books_test.py ateAclEntry(returned_rule.GetEditLink().href, updated_rule) - except gdata.service.RequestError, error: + except gdata.service.RequestError as error: self.assertEqual(error[0]['status'], 403) self.assertEqual(error[0]['reason'], "Forbidden") @@ -168,7 +168,7 @@ updated_rule.scope.type = "domain" try: returned_rule = self.cal_client.UpdateAclEntry(returned_rule.GetEditLink().href, updated_rule) - except gdata.service.RequestError, error: + except gdata.service.RequestError as error: self.assertEqual(error[0]['status'], 403) self.assertEqual(error[0]['reason'], "Forbidden") @@ -193,9 +193,9 @@ self.cal_client.DeleteAclEntry(updated_rule.GetEditLink().href) if __name__ == '__main__': - print ('NOTE: Please run these tests only with a test account. ' + - 'The tests may delete or update your data.') - username = raw_input('Please enter your username: ') + print(('NOTE: Please run these tests only with a test account. ' + + 'The tests may delete or update your data.')) + username = input('Please enter your username: ') password = getpass.getpass() unittest.main() --- ./tests/gdata_tests/books_test.py (original) +++ ./tests/gdata_tests/books_test.py (refactored) @@ -14,38 +14,38 @@ def testBookEntryFromString(self): entry = gdata.books.Book.FromString(test_data.BOOK_ENTRY) - self.assert_(isinstance(entry, gdata.books.Book)) - self.assertEquals([x.text for x in entry.creator], ['John Rawls']) - self.assertEquals(entry.date.text, '1999') - self.assertEquals(entry.format.text, '538 pages') - self.assertEquals([x.text for x in entry.identifier], + self.assertTrue(isinstance(entry, gdata.books.Book)) + self.assertEqual([x.text for x in entry.creator], ['John Rawls']) + self.assertEqual(entry.date.text, '1999') + self.assertEqual(entry.format.text, '538 pages') + self.assertEqual([x.text for x in entry.identifier], ['b7GZr5Btp30C', 'ISBN:0198250541', 'ISBN:9780198250548']) - self.assertEquals([x.text for x in entry.publisher], + self.assertEqual([x.text for x in entry.publisher], ['Oxford University Press']) - self.assertEquals(entry.subject, None) - self.assertEquals([x.text for x in entry.dc_title], + self.assertEqual(entry.subject, None) + self.assertEqual([x.text for x in entry.dc_title], ['A theory of justice']) - self.assertEquals(entry.viewability.value, + self.assertEqual(entry.viewability.value, 'http://schemas.google.com/books/2008#view_partial') - self.assertEquals(entry.embeddability.value, + self.assertEqual(entry.embeddability.value, 'http://schemas.google.com/books/2008#embeddable') - self.assertEquals(entry.review, None) - self.assertEquals([getattr(entry.rating, x) for x in + self.assertEqual(entry.review, None) + self.assertEqual([getattr(entry.rating, x) for x in ("min", "max", "average", "value")], ['1', '5', '4.00', None]) - self.assertEquals(entry.GetThumbnailLink().href, + self.assertEqual(entry.GetThumbnailLink().href, 'http://bks0.books.google.com/books?id=b7GZr5Btp30C&printsec=frontcover&img=1&zoom=5&sig=ACfU3U121bWZsbjBfVwVRSK2o982jJTd1w&source=gbs_gdata') - self.assertEquals(entry.GetInfoLink().href, + self.assertEqual(entry.GetInfoLink().href, 'http://books.google.com/books?id=b7GZr5Btp30C&ie=ISO-8859-1&source=gbs_gdata') - self.assertEquals(entry.GetPreviewLink(), None) - self.assertEquals(entry.GetAnnotationLink().href, + self.assertEqual(entry.GetPreviewLink(), None) + self.assertEqual(entry.GetAnnotationLink().href, 'http://www.google.com/books/feeds/users/me/volumes') - self.assertEquals(entry.get_google_id(), 'b7GZr5Btp30C') + self.assertEqual(entry.get_google_id(), 'b7GZr5Btp30C') def testBookFeedFRefactoringTool: Refactored ./tests/gdata_tests/books/service_test.py RefactoringTool: Refactored ./tests/gdata_tests/blogger_test.py romString(self): feed = gdata.books.BookFeed.FromString(test_data.BOOK_FEED) - self.assert_(isinstance(feed, gdata.books.BookFeed)) - self.assertEquals( len(feed.entry), 1) - self.assert_(isinstance(feed.entry[0], gdata.books.Book)) + self.assertTrue(isinstance(feed, gdata.books.BookFeed)) + self.assertEqual( len(feed.entry), 1) + self.assertTrue(isinstance(feed.entry[0], gdata.books.Book)) def testBookEntryToDict(self): book = gdata.books.Book() --- ./tests/gdata_tests/books/service_test.py (original) +++ ./tests/gdata_tests/books/service_test.py (refactored) @@ -27,12 +27,12 @@ def testPublicSearch(self): entry = self.service.get_by_google_id("b7GZr5Btp30C") - self.assertEquals((entry.creator[0].text, entry.dc_title[0].text), + self.assertEqual((entry.creator[0].text, entry.dc_title[0].text), ('John Rawls', 'A theory of justice')) feed = self.service.search_by_keyword(isbn="9780198250548") feed1 = self.service.search("9780198250548") - self.assertEquals(len(feed.entry), 1) - self.assertEquals(len(feed1.entry), 1) + self.assertEqual(len(feed.entry), 1) + self.assertEqual(len(feed1.entry), 1) def testLibraryCrd(self): """ @@ -45,11 +45,11 @@ entry = self.service.get_by_google_id("b7GZr5Btp30C") entry = self.service.add_item_to_library(entry) lib = list(self.service.get_library()) - self.assert_(entry.to_dict()['title'] in + self.assertTrue(entry.to_dict()['title'] in [x.to_dict()['title'] for x in lib]) self.service.remove_item_from_library(entry) lib = list(self.service.get_library()) - self.assert_(entry.to_dict()['title'] not in + self.assertTrue(entry.to_dict()['title'] not in [x.to_dict()['title'] for x in lib]) def testAnnotations(self): @@ -58,7 +58,7 @@ if __name__ == "__main__": - print "Please use a test account. May cause data loss." - username = raw_input("Google Username: ").strip() + print("Please use a test account. May cause data loss.") + username = input("Google Username: ").strip() password = getpass.getpass() unittest.main() --- ./tests/gdata_tests/blogger_test.py (original) +++ ./tests/gdata_tests/blogger_test.py (refactored) @@ -28,42 +28,42 @@ def testBlogEntryFromString(self): entry = gdata.blogger.BlogEntryFromString(test_data.BLOG_ENTRY) - self.assertEquals(entry.GetBlogName(), 'blogName') - self.assertEquals(entry.GetBlogId(), 'blogID') - self.assertEquals(entry.title.text, 'Lizzy\'s Diary') + self.assertEqual(entry.GetBlogName(), 'blogName') + self.assertEqual(entry.GetBlogId(), 'blogID') + self.assertEqual(entry.title.text, 'Lizzy\'s Diary') def testBlogPostFeedFromString(self): feed = gdata.blogger.BlogPostFeedFromString(test_data.BLOG_POSTS_FEED) - self.assertEquals(len(feed.entry), 1) - self.assert_(isinstance(feed, gdata.blogger.BlogPostFeed)) - self.assert_(isinstance(feed.entry[0], gdata.blogger.BlogPostEntry)) - self.assertEquals(feed.entry[0].GetPostId(), 'postID') - self.assertEquals(feed.entry[0].GetBlogId(), 'blogID') - self.assertEquals(feed.entry[0].title.text, 'Quite disagreeable') + self.assertEqual(len(feed.entry), 1) + self.assertTrue(isinstance(feed, gdata.blogger.BlogPostFeed)) + self.assertTrue(isinstance(feed.entry[0], gdata.blogger.BlogPostEntry)) + self.assertEqual(feed.entry[0].GetPostId(), 'postID') + self.assertEqual(feed.entry[0].GetBlogId(), 'blogID') + self.assertEqual(feed.entry[0].title.text, 'Quite disagreeable') def testCommentFeedFromString(self): feed = gdata.blogger.CommentFeedFromString(test_data.BLOG_COMMENTS_FEED) - self.assertEquals(len(feed.entry), 1) - self.assert_(isinstance(feed, gdata.blogger.CommentFeed)) - self.assert_(isinstance(feed.entry[0], gdata.blogger.CommentEntry)) - self.assertEquals(feed.entry[0].GetBlogId(), 'blogID') - self.assertEquaRefactoringTool: Refactored ./tests/gdata_tests/blogger/service_test.py ls(feed.entry[0].GetCommentId(), 'commentID') - self.assertEquals(feed.entry[0].title.text, 'This is my first comment') - self.assertEquals(feed.entry[0].in_reply_to.source, + self.assertEqual(len(feed.entry), 1) + self.assertTrue(isinstance(feed, gdata.blogger.CommentFeed)) + self.assertTrue(isinstance(feed.entry[0], gdata.blogger.CommentEntry)) + self.assertEqual(feed.entry[0].GetBlogId(), 'blogID') + self.assertEqual(feed.entry[0].GetCommentId(), 'commentID') + self.assertEqual(feed.entry[0].title.text, 'This is my first comment') + self.assertEqual(feed.entry[0].in_reply_to.source, 'http://blogName.blogspot.com/feeds/posts/default/postID') - self.assertEquals(feed.entry[0].in_reply_to.ref, + self.assertEqual(feed.entry[0].in_reply_to.ref, 'tag:blogger.com,1999:blog-blogID.post-postID') - self.assertEquals(feed.entry[0].in_reply_to.href, + self.assertEqual(feed.entry[0].in_reply_to.href, 'http://blogName.blogspot.com/2007/04/first-post.html') - self.assertEquals(feed.entry[0].in_reply_to.type, 'text/html') + self.assertEqual(feed.entry[0].in_reply_to.type, 'text/html') def testIdParsing(self): entry = gdata.blogger.BlogEntry() entry.id = atom.Id( text='tag:blogger.com,1999:user-146606542.blog-4023408167658848') - self.assertEquals(entry.GetBlogId(), '4023408167658848') + self.assertEqual(entry.GetBlogId(), '4023408167658848') entry.id = atom.Id(text='tag:blogger.com,1999:blog-4023408167658848') - self.assertEquals(entry.GetBlogId(), '4023408167658848') + self.assertEqual(entry.GetBlogId(), '4023408167658848') class InReplyToTest(unittest.TestCase): @@ -74,10 +74,10 @@ type='text/html') xml_string = str(in_reply_to) parsed = gdata.blogger.InReplyToFromString(xml_string) - self.assertEquals(parsed.source, in_reply_to.source) - self.assertEquals(parsed.href, in_reply_to.href) - self.assertEquals(parsed.ref, in_reply_to.ref) - self.assertEquals(parsed.type, in_reply_to.type) + self.assertEqual(parsed.source, in_reply_to.source) + self.assertEqual(parsed.href, in_reply_to.href) + self.assertEqual(parsed.ref, in_reply_to.ref) + self.assertEqual(parsed.type, in_reply_to.type) class CommentEntryTest(unittest.TestCase): @@ -87,8 +87,8 @@ in_reply_to=gdata.blogger.InReplyTo( source='http://example.com/my_post')) parsed = gdata.blogger.CommentEntryFromString(str(comment)) - self.assertEquals(parsed.in_reply_to.source, comment.in_reply_to.source) - self.assertEquals(parsed.content.text, comment.content.text) + self.assertEqual(parsed.in_reply_to.source, comment.in_reply_to.source) + self.assertEqual(parsed.content.text, comment.content.text) if __name__ == '__main__': --- ./tests/gdata_tests/blogger/service_test.py (original) +++ ./tests/gdata_tests/blogger/service_test.py (refactored) @@ -49,18 +49,18 @@ posted = self.client.AddPost(new_entry, blog_id=test_blog_id) - self.assertEquals(posted.title.text, new_entry.title.text) + self.assertEqual(posted.title.text, new_entry.title.text) # Should be one category in the posted entry for the 'test' label. - self.assertEquals(len(posted.category), 1) - self.assert_(isinstance(posted, gdata.blogger.BlogPostEntry)) + self.assertEqual(len(posted.category), 1) + self.assertTrue(isinstance(posted, gdata.blogger.BlogPostEntry)) # Change the title and add more labels. posted.title.text = 'Updated' posted.AddLabel('second') updated = self.client.UpdatePost(entry=posted) - self.assertEquals(updated.title.text, 'Updated') - self.assertEquals(len(updated.category), 2) + self.assertEqual(updated.title.text, 'Updated') + self.assertEqual(len(updated.category), 2) # Cleanup and delete the draft blog post. self.client.DeletePost(entry=posted) @@ -79,7 +79,7 @@ new_comment.content = atom.Content(text='Test comment') posted = self.client.AddComment(new_comment, blog_id=blog_id, post_id=postRefactoringTool: Refactored ./tests/gdata_tests/blogger/live_client_test.py RefactoringTool: Refactored ./tests/gdata_tests/blogger/data_test.py _id) - self.assertEquals(posted.content.text, new_comment.content.text) + self.assertEqual(posted.content.text, new_comment.content.text) # Cleanup and delete the comment test blog post. self.client.DeletePost(entry=target_post) @@ -98,10 +98,10 @@ if __name__ == '__main__': - print ('NOTE: Please run these tests only with a test account. ' + - 'The tests may delete or update your data.') - username = raw_input('Please enter your username: ') + print(('NOTE: Please run these tests only with a test account. ' + + 'The tests may delete or update your data.')) + username = input('Please enter your username: ') password = getpass.getpass() - test_blog_id = raw_input('Please enter the blog id for the test blog: ') + test_blog_id = input('Please enter the blog id for the test blog: ') unittest.main() --- ./tests/gdata_tests/blogger/live_client_test.py (original) +++ ./tests/gdata_tests/blogger/live_client_test.py (refactored) @@ -63,14 +63,14 @@ self.assertEqual(created.title.text, 'test post from BloggerClientTest') self.assertEqual(created.content.text, 'Hey look, another test!') self.assertEqual(len(created.category), 2) - self.assert_(created.control is None) + self.assertTrue(created.control is None) # Change the title of the blog post we just added. created.title.text = 'Edited' updated = self.client.update(created) self.assertEqual(updated.title.text, 'Edited') - self.assert_(isinstance(updated, gdata.blogger.data.BlogPost)) + self.assertTrue(isinstance(updated, gdata.blogger.data.BlogPost)) self.assertEqual(updated.content.text, created.content.text) # Delete the test entry from the blog. @@ -91,8 +91,8 @@ 'draft test post from BloggerClientTest') self.assertEqual(created.content.text, 'This should only be a draft.') self.assertEqual(len(created.category), 2) - self.assert_(created.control is not None) - self.assert_(created.control.draft is not None) + self.assertTrue(created.control is not None) + self.assertTrue(created.control.draft is not None) self.assertEqual(created.control.draft.text, 'yes') # Publish the blog post. @@ -122,8 +122,8 @@ self.assertEqual(created.title.text, 'draft page from BloggerClientTest') self.assertEqual(created.content.text, 'draft content') - self.assert_(created.control is not None) - self.assert_(created.control.draft is not None) + self.assertTrue(created.control is not None) + self.assertTrue(created.control.draft is not None) self.assertEqual(created.control.draft.text, 'yes') self.assertEqual(str(int(created.get_page_id())), created.get_page_id()) --- ./tests/gdata_tests/blogger/data_test.py (original) +++ ./tests/gdata_tests/blogger/data_test.py (refactored) @@ -29,45 +29,45 @@ def testBlogEntryFromString(self): entry = atom.core.parse(test_data.BLOG_ENTRY, gdata.blogger.data.Blog) - self.assertEquals(entry.GetBlogName(), 'blogName') - self.assertEquals(entry.GetBlogId(), 'blogID') - self.assertEquals(entry.title.text, 'Lizzy\'s Diary') + self.assertEqual(entry.GetBlogName(), 'blogName') + self.assertEqual(entry.GetBlogId(), 'blogID') + self.assertEqual(entry.title.text, 'Lizzy\'s Diary') def testBlogPostFeedFromString(self): feed = atom.core.parse(test_data.BLOG_POSTS_FEED, gdata.blogger.data.BlogPostFeed) - self.assertEquals(len(feed.entry), 1) - self.assert_(isinstance(feed, gdata.blogger.data.BlogPostFeed)) - self.assert_(isinstance(feed.entry[0], gdata.blogger.data.BlogPost)) - self.assertEquals(feed.entry[0].GetPostId(), 'postID') - self.assertEquals(feed.entry[0].GetBlogId(), 'blogID') - self.assertEquals(feed.entry[0].title.text, 'Quite disagreeable') + self.assertEqual(len(feed.entry), 1) + self.assertTrue(isinstance(feed, gdata.blogger.data.BlogPostFeed)) + self.assertTrue(isinstance(feed.entry[0], gdata.blogger.data.BlogPost)) + self.assertEqual(feed.entry[0].GetPosRefactoringTool: Refactored ./tests/gdata_tests/auth_test.py tId(), 'postID') + self.assertEqual(feed.entry[0].GetBlogId(), 'blogID') + self.assertEqual(feed.entry[0].title.text, 'Quite disagreeable') def testCommentFeedFromString(self): feed = atom.core.parse(test_data.BLOG_COMMENTS_FEED, gdata.blogger.data.CommentFeed) - self.assertEquals(len(feed.entry), 1) - self.assert_(isinstance(feed, gdata.blogger.data.CommentFeed)) - self.assert_(isinstance(feed.entry[0], gdata.blogger.data.Comment)) - self.assertEquals(feed.entry[0].get_blog_id(), 'blogID') - self.assertEquals(feed.entry[0].get_blog_name(), 'a-blogName') - self.assertEquals(feed.entry[0].get_comment_id(), 'commentID') - self.assertEquals(feed.entry[0].title.text, 'This is my first comment') - self.assertEquals(feed.entry[0].in_reply_to.source, + self.assertEqual(len(feed.entry), 1) + self.assertTrue(isinstance(feed, gdata.blogger.data.CommentFeed)) + self.assertTrue(isinstance(feed.entry[0], gdata.blogger.data.Comment)) + self.assertEqual(feed.entry[0].get_blog_id(), 'blogID') + self.assertEqual(feed.entry[0].get_blog_name(), 'a-blogName') + self.assertEqual(feed.entry[0].get_comment_id(), 'commentID') + self.assertEqual(feed.entry[0].title.text, 'This is my first comment') + self.assertEqual(feed.entry[0].in_reply_to.source, 'http://blogName.blogspot.com/feeds/posts/default/postID') - self.assertEquals(feed.entry[0].in_reply_to.ref, + self.assertEqual(feed.entry[0].in_reply_to.ref, 'tag:blogger.com,1999:blog-blogID.post-postID') - self.assertEquals(feed.entry[0].in_reply_to.href, + self.assertEqual(feed.entry[0].in_reply_to.href, 'http://blogName.blogspot.com/2007/04/first-post.html') - self.assertEquals(feed.entry[0].in_reply_to.type, 'text/html') + self.assertEqual(feed.entry[0].in_reply_to.type, 'text/html') def testIdParsing(self): entry = gdata.blogger.data.Blog() entry.id = atom.data.Id( text='tag:blogger.com,1999:user-146606542.blog-4023408167658848') - self.assertEquals(entry.GetBlogId(), '4023408167658848') + self.assertEqual(entry.GetBlogId(), '4023408167658848') entry.id = atom.data.Id(text='tag:blogger.com,1999:blog-4023408167658848') - self.assertEquals(entry.GetBlogId(), '4023408167658848') + self.assertEqual(entry.GetBlogId(), '4023408167658848') class InReplyToTest(unittest.TestCase): @@ -78,10 +78,10 @@ source='http://example.com/my_post', type='text/html') xml_string = str(in_reply_to) parsed = atom.core.parse(xml_string, gdata.blogger.data.InReplyTo) - self.assertEquals(parsed.source, in_reply_to.source) - self.assertEquals(parsed.href, in_reply_to.href) - self.assertEquals(parsed.ref, in_reply_to.ref) - self.assertEquals(parsed.type, in_reply_to.type) + self.assertEqual(parsed.source, in_reply_to.source) + self.assertEqual(parsed.href, in_reply_to.href) + self.assertEqual(parsed.ref, in_reply_to.ref) + self.assertEqual(parsed.type, in_reply_to.type) class CommentTest(unittest.TestCase): @@ -92,8 +92,8 @@ in_reply_to=gdata.blogger.data.InReplyTo( source='http://example.com/my_post')) parsed = atom.core.parse(str(comment), gdata.blogger.data.Comment) - self.assertEquals(parsed.in_reply_to.source, comment.in_reply_to.source) - self.assertEquals(parsed.content.text, comment.content.text) + self.assertEqual(parsed.in_reply_to.source, comment.in_reply_to.source) + self.assertEqual(parsed.content.text, comment.content.text) def suite(): --- ./tests/gdata_tests/auth_test.py (original) +++ ./tests/gdata_tests/auth_test.py (refactored) @@ -20,7 +20,7 @@ import re import unittest -import urllib +import urllib.request, urllib.parse, urllib.error import gdata.auth @@ -67,13 +67,13 @@ parameters = body.split('&') for param in parameters: (name, value) = param.split('=') - self.assert_(expected_name_value_pairs[name] == value) + self.assertTrue(expected_name_value_pairs[name] == value) def testGenerateClientLoginAuthToken(self): http_body = ('SID=DQAAAGgA7Zg8CTN\r\n' 'LSID=DQAAAGsAlk8BBbG\r\n' 'Auth=DQAAAGgAdk3fA5N') - self.assert_(gdata.auth.GenerateClientLoginAuthToken(http_body) == + self.assertTrue(gdata.auth.GenerateClientLoginAuthToken(http_body) == 'GoogleLogin auth=DQAAAGgAdk3fA5N') @@ -82,17 +82,17 @@ def testPostBodyShouldMatchShortExample(self): auth_body = gdata.auth.GenerateClientLoginRequestBody('johndoe@gmail.com', 'north23AZ', 'cl', 'Gulp-CalGulp-1.05') - self.assert_(-1 < auth_body.find('Email=johndoe%40gmail.com')) - self.assert_(-1 < auth_body.find('Passwd=north23AZ')) - self.assert_(-1 < auth_body.find('service=cl')) - self.assert_(-1 < auth_body.find('source=Gulp-CalGulp-1.05')) + self.assertTrue(-1 < auth_body.find('Email=johndoe%40gmail.com')) + self.assertTrue(-1 < auth_body.find('Passwd=north23AZ')) + self.assertTrue(-1 < auth_body.find('service=cl')) + self.assertTrue(-1 < auth_body.find('source=Gulp-CalGulp-1.05')) def testPostBodyShouldMatchLongExample(self): auth_body = gdata.auth.GenerateClientLoginRequestBody('johndoe@gmail.com', 'north23AZ', 'cl', 'Gulp-CalGulp-1.05', captcha_token='DQAAAGgA...dkI1', captcha_response='brinmar') - self.assert_(-1 < auth_body.find('logintoken=DQAAAGgA...dkI1')) - self.assert_(-1 < auth_body.find('logincaptcha=brinmar')) + self.assertTrue(-1 < auth_body.find('logintoken=DQAAAGgA...dkI1')) + self.assertTrue(-1 < auth_body.find('logincaptcha=brinmar')) def testEquivalenceWithOldLogic(self): email = 'jo@gmail.com' @@ -100,7 +100,7 @@ account_type = 'HOSTED' service = 'test' source = 'auth test' - old_request_body = urllib.urlencode({'Email': email, + old_request_body = urllib.parse.urlencode({'Email': email, 'Passwd': password, 'accountType': account_type, 'service': service, @@ -108,7 +108,7 @@ new_request_body = gdata.auth.GenerateClientLoginRequestBody(email, password, service, source, account_type=account_type) for parameter in old_request_body.split('&'): - self.assert_(-1 < new_request_body.find(parameter)) + self.assertTrue(-1 < new_request_body.find(parameter)) class GenerateAuthSubUrlTest(unittest.TestCase): @@ -116,24 +116,24 @@ def testDefaultParameters(self): url = gdata.auth.GenerateAuthSubUrl('http://example.com/xyz?x=5', 'http://www.google.com/test/feeds') - self.assert_(-1 < url.find( + self.assertTrue(-1 < url.find( r'scope=http%3A%2F%2Fwww.google.com%2Ftest%2Ffeeds')) - self.assert_(-1 < url.find( + self.assertTrue(-1 < url.find( r'next=http%3A%2F%2Fexample.com%2Fxyz%3Fx%3D5')) - self.assert_(-1 < url.find('secure=0')) - self.assert_(-1 < url.find('session=1')) + self.assertTrue(-1 < url.find('secure=0')) + self.assertTrue(-1 < url.find('session=1')) def testAllParameters(self): url = gdata.auth.GenerateAuthSubUrl('http://example.com/xyz?x=5', 'http://www.google.com/test/feeds', secure=True, session=False, request_url='https://example.com/auth') - self.assert_(-1 < url.find( + self.assertTrue(-1 < url.find( r'scope=http%3A%2F%2Fwww.google.com%2Ftest%2Ffeeds')) - self.assert_(-1 < url.find( + self.assertTrue(-1 < url.find( r'next=http%3A%2F%2Fexample.com%2Fxyz%3Fx%3D5')) - self.assert_(-1 < url.find('secure=1')) - self.assert_(-1 < url.find('session=0')) - self.assert_(url.startswith('https://example.com/auth')) + self.assertTrue(-1 < url.find('secure=1')) + self.assertTrue(-1 < url.find('session=0')) + self.assertTrue(url.startswith('https://example.com/auth')) class GenerateOAuthRequestTokenUrlTest(unittest.TestCase): @@ -148,19 +148,19 @@ ] url = gdata.auth.GenerateOAuthRequestTokenUrl( oauth_input_params, scopes=scopes) - self.assertEquals('https', url.protocol) - self.assertEquals('www.google.com', url.host) - self.assertEquals('/accounts/OAuthGetRequestToken', url.path) - self.assertEquals('1.0', url.params['oauth_version']) - self.assertEquals('RSA-SHA1', url.params['oauth_signature_method']) - self.assert_(url.params['oauth_nonce']) - self.assert_(url.params['oauth_timestamp']) + self.assertEqual('https', url.protocol) + self.assertEqual('www.google.com', url.host) + self.assertEqual('/accounts/OAuthGetRequestToken', url.path) + self.assertEqual('1.0', url.params['oauth_version']) + self.assertEqual('RSA-SHA1', url.params['oauth_signature_method']) + self.assertTrue(url.params['oauth_nonce']) + self.assertTrue(url.params['oauth_timestamp']) actual_scopes = url.params['scope'].split(' ') - self.assertEquals(2, len(actual_scopes)) + self.assertEqual(2, len(actual_scopes)) for scope in actual_scopes: - self.assert_(scope in scopes) - self.assertEquals(CONSUMER_KEY, url.params['oauth_consumer_key']) - self.assert_(url.params['oauth_signature']) + self.assertTrue(scope in scopes) + self.assertEqual(CONSUMER_KEY, url.params['oauth_consumer_key']) + self.assertTrue(url.params['oauth_signature']) def testAllParameters(self): oauth_input_params = gdata.auth.OAuthInputParams( @@ -171,20 +171,20 @@ oauth_input_params, scopes=scopes, request_token_url='https://www.example.com/accounts/OAuthRequestToken', extra_parameters={'oauth_version': '2.0', 'my_param': 'my_value'}) - self.assertEquals('https', url.protocol) - self.assertEquals('www.example.com', url.host) - self.assertEquals('/accounts/OAuthRequestToken', url.path) - self.assertEquals('2.0', url.params['oauth_version']) - self.assertEquals('HMAC-SHA1', url.params['oauth_signature_method']) - self.assert_(url.params['oauth_nonce']) - self.assert_(url.params['oauth_timestamp']) + self.assertEqual('https', url.protocol) + self.assertEqual('www.example.com', url.host) + self.assertEqual('/accounts/OAuthRequestToken', url.path) + self.assertEqual('2.0', url.params['oauth_version']) + self.assertEqual('HMAC-SHA1', url.params['oauth_signature_method']) + self.assertTrue(url.params['oauth_nonce']) + self.assertTrue(url.params['oauth_timestamp']) actual_scopes = url.params['scope'].split(' ') - self.assertEquals(1, len(actual_scopes)) + self.assertEqual(1, len(actual_scopes)) for scope in actual_scopes: - self.assert_(scope in scopes) - self.assertEquals(CONSUMER_KEY, url.params['oauth_consumer_key']) - self.assert_(url.params['oauth_signature']) - self.assertEquals('my_value', url.params['my_param']) + self.assertTrue(scope in scopes) + self.assertEqual(CONSUMER_KEY, url.params['oauth_consumer_key']) + self.assertTrue(url.params['oauth_signature']) + self.assertEqual('my_value', url.params['my_param']) class GenerateOAuthAuthorizationUrlTest(unittest.TestCase): @@ -194,10 +194,10 @@ token_secret = 'SDFDSGSDADADSAF' request_token = gdata.auth.OAuthToken(key=token_key, secret=token_secret) url = gdata.auth.GenerateOAuthAuthorizationUrl(request_token) - self.assertEquals('https', url.protocol) - self.assertEquals('www.google.com', url.host) - self.assertEquals('/accounts/OAuthAuthorizeToken', url.path) - self.assertEquals(token_key, url.params['oauth_token']) + self.assertEqual('https', url.protocol) + self.assertEqual('www.google.com', url.host) + self.assertEqual('/accounts/OAuthAuthorizeToken', url.path) + self.assertEqual(token_key, url.params['oauth_token']) def testAllParameters(self): token_key = 'ABCDDSFFDSG' @@ -214,14 +214,14 @@ callback_url='http://www.yourwebapp.com/print', extra_params={'permission': '1'}, include_scopes_in_callback=True, scopes_param_prefix='token_scope') - self.assertEquals('https', url.protocol) - self.assertEquals('www.example.com', url.host) - self.assertEquals('/accounts/OAuthAuthToken', url.path) - self.assertEquals(token_key, url.params['oauth_token']) + self.assertEqual('https', url.protocol) + self.assertEqual('www.example.com', url.host) + self.assertEqual('/accounts/OAuthAuthToken', url.path) + self.assertEqual(token_key, url.params['oauth_token']) expected_callback_url = ('http://www.yourwebapp.com/print?' 'token_scope=http%3A%2F%2Fabcd.example.com%2Ffeeds' '+http%3A%2F%2Fwww.example.com%2Fabcd%2Ffeeds') - self.assertEquals(expected_callback_url, url.params['oauth_callback']) + self.assertEqual(expected_callback_url, url.params['oauth_callback']) class GenerateOAuthAccessTokenUrlTest(unittest.TestCase): @@ -236,16 +236,16 @@ consumer_secret=CONSUMER_SECRET) url = gdata.auth.GenerateOAuthAccessTokenUrl(authorized_request_token, oauth_input_params) - self.assertEquals('https', url.protocol) - self.assertEquals('www.google.com', url.host) - self.assertEquals('/accounts/OAuthGetAccessToken', url.path) - self.assertEquals(token_key, url.params['oauth_token']) - self.assertEquals('1.0', url.params['oauth_version']) - self.assertEquals('HMAC-SHA1', url.params['oauth_signature_method']) - self.assert_(url.params['oauth_nonce']) - self.assert_(url.params['oauth_timestamp']) - self.assertEquals(CONSUMER_KEY, url.params['oauth_consumer_key']) - self.assert_(url.params['oauth_signature']) + self.assertEqual('https', url.protocol) + self.assertEqual('www.google.com', url.host) + self.assertEqual('/accounts/OAuthGetAccessToken', url.path) + self.assertEqual(token_key, url.params['oauth_token']) + self.assertEqual('1.0', url.params['oauth_version']) + self.assertEqual('HMAC-SHA1', url.params['oauth_signature_method']) + self.assertTrue(url.params['oauth_nonce']) + self.assertTrue(url.params['oauth_timestamp']) + self.assertEqual(CONSUMER_KEY, url.params['oauth_consumer_key']) + self.assertTrue(url.params['oauth_signature']) def testAllParameters(self): token_key = 'ABCDDSFFDSG' @@ -257,34 +257,34 @@ authorized_request_token, oauth_input_params, access_token_url='https://www.example.com/accounts/OAuthGetAccessToken', oauth_version= '2.0') - self.assertEquals('https', url.protocol) - self.assertEquals('www.example.com', url.host) - self.assertEquals('/accounts/OAuthGetAccessToken', url.path) - self.assertEquals(token_key, url.params['oauth_token']) - self.assertEquals('2.0', url.params['oauth_version']) - self.assertEquals('RSA-SHA1', url.params['oauth_signature_method']) - self.assert_(url.params['oauth_nonce']) - self.assert_(url.params['oauth_timestamp']) - self.assertEquals(CONSUMER_KEY, url.params['oauth_consumer_key']) - self.assert_(url.params['oauth_signature']) + self.assertEqual('https', url.protocol) + self.assertEqual('www.example.com', url.host) + self.assertEqual('/accounts/OAuthGetAccessToken', url.path) + self.assertEqual(token_key, url.params['oauth_token']) + self.assertEqual('2.0', url.params['oauth_version']) + self.assertEqual('RSA-SHA1', url.params['oauth_signature_method']) + self.assertTrue(url.params['oauth_nonce']) + self.assertTrue(url.params['oauth_timestamp']) + self.assertEqual(CONSUMER_KEY, url.params['oauth_consumer_key']) + self.assertTrue(url.params['oauth_signature']) class ExtractAuthSubTokensTest(unittest.TestCase): def testGetTokenFromUrl(self): url = 'http://www.yourwebapp.com/showcalendar.html?token=CKF50YzIH' - self.assert_(gdata.auth.AuthSubTokenFromUrl(url) == + self.assertTrue(gdata.auth.AuthSubTokenFromUrl(url) == 'AuthSub token=CKF50YzIH') - self.assert_(gdata.auth.TokenFromUrl(url) == 'CKF50YzIH') + self.assertTrue(gdata.auth.TokenFromUrl(url) == 'CKF50YzIH') url = 'http://www.yourwebapp.com/showcalendar.html?token==tokenCKF50YzIH=' - self.assert_(gdata.auth.AuthSubTokenFromUrl(url) == + self.assertTrue(gdata.auth.AuthSubTokenFromUrl(url) == 'AuthSub token==tokenCKF50YzIH=') - self.assert_(gdata.auth.TokenFromUrl(url) == '=tokenCKF50YzIH=') + self.assertTrue(gdata.auth.TokenFromUrl(url) == '=tokenCKF50YzIH=') def testGetTokenFromHttpResponse(self): response_body = ('Token=DQAA...7DCTN\r\n' 'Expiration=20061004T123456Z') - self.assert_(gdata.auth.AuthSubTokenFromHttpBody(response_body) == + self.assertTrue(gdata.auth.AuthSubTokenFromHttpBody(response_body) == 'AuthSub token=DQAA...7DCTN') class CreateAuthSubTokenFlowTest(unittest.TestCase): @@ -293,33 +293,33 @@ request_url = gdata.auth.generate_auth_sub_url(next='http://example.com', scopes=['http://www.blogger.com/feeds/', 'http://www.google.com/base/feeds/']) - self.assertEquals(request_url.protocol, 'https') - self.assertEquals(request_url.host, 'www.google.com') - self.assertEquals(request_url.params['scope'], + self.assertEqual(request_url.protocol, 'https') + self.assertEqual(request_url.host, 'www.google.com') + self.assertEqual(request_url.params['scope'], 'http://www.blogger.com/feeds/ http://www.google.com/base/feeds/') - self.assertEquals(request_url.params['hd'], 'default') - self.assert_(request_url.params['next'].find('auth_sub_scopes') > -1) - self.assert_(request_url.params['next'].startswith('http://example.com')) + self.assertEqual(request_url.params['hd'], 'default') + self.assertTrue(request_url.params['next'].find('auth_sub_scopes') > -1) + self.assertTrue(request_url.params['next'].startswith('http://example.com')) # Use a more complicated 'next' URL. request_url = gdata.auth.generate_auth_sub_url( next='http://example.com/?token_scope=http://www.blogger.com/feeds/', scopes=['http://www.blogger.com/feeds/', 'http://www.google.com/base/feeds/']) - self.assert_(request_url.params['next'].find('auth_sub_scopes') > -1) - self.assert_(request_url.params['next'].find('token_scope') > -1) - self.assert_(request_url.params['next'].startswith('http://example.com/')) + self.assertTrue(request_url.params['next'].find('auth_sub_scopes') > -1) + self.assertTrue(request_url.params['next'].find('token_scope') > -1) + self.assertTrue(request_url.params['next'].startswith('http://example.com/')) def testParseNextUrl(self): url = ('http://example.com/?auth_sub_scopes=http%3A%2F%2Fwww.blogger.com' '%2Ffeeds%2F+http%3A%2F%2Fwww.google.com%2Fbase%2Ffeeds%2F&' 'token=my_nifty_token') token = gdata.auth.extract_auth_sub_token_from_url(url) - self.assertEquals(token.get_token_string(), 'my_nifty_token') - self.assert_(isinstance(token, gdata.auth.AuthSubToken)) - self.assert_(token.valid_for_scope('http://www.blogger.com/feeds/')) - self.assert_(token.valid_for_scope('http://www.google.com/base/feeds/')) - self.assert_( + self.assertEqual(token.get_token_string(), 'my_nifty_token') + self.assertTrue(isinstance(token, gdata.auth.AuthSubToken)) + self.assertTrue(token.valid_for_scope('http://www.blogger.com/feeds/')) + self.assertTrue(token.valid_for_scope('http://www.google.com/base/feeds/')) + self.assertTrue( not token.valid_for_scope('http://www.google.com/calendar/feeds/')) # Parse a more complicated response. @@ -328,19 +328,19 @@ 'token_scope=http%3A%2F%2Fwww.blogger.com%2Ffeeds%2F&' 'token=second_token') token = gdata.auth.extract_auth_sub_token_from_url(url) - self.assertEquals(token.get_token_string(), 'second_token') - self.assert_(isinstance(token, gdata.auth.AuthSubToken)) - self.assert_(token.valid_for_scope('http://www.blogger.com/feeds/')) - self.assert_(token.valid_for_scope('http://www.google.com/base/feeds/')) - self.assert_( + self.assertEqual(token.get_token_string(), 'second_token') + self.assertTrue(isinstance(token, gdata.auth.AuthSubToken)) + self.assertTrue(token.valid_for_scope('http://www.blogger.com/feeds/')) + self.assertTrue(token.valid_for_scope('http://www.google.com/base/feeds/')) + self.assertTrue( not token.valid_for_scope('http://www.google.com/calendar/feeds/')) def testParseNextWithNoToken(self): token = gdata.auth.extract_auth_sub_token_from_url('http://example.com/') - self.assert_(token is None) + self.assertTrue(token is None) token = gdata.auth.extract_auth_sub_token_from_url( 'http://example.com/?no_token=foo&other=1') - self.assert_(token is None) + self.assertTrue(token is None) class ExtractClientLoginTokenTest(unittest.TestCase): @@ -351,10 +351,10 @@ 'Auth=DQAAAGgAdk3fA5N') token = gdata.auth.extract_client_login_token(http_body_string, ['http://docs.google.com/feeds/']) - self.assertEquals(token.get_token_string(), 'DQAAAGgAdk3fA5N') - self.assert_(isinstance(token, gdata.auth.ClientLoginToken)) - self.assert_(token.valid_for_scope('http://docs.google.com/feeds/')) - self.assert_(not token.valid_for_scope('http://www.blogger.com/feeds')) + self.assertEqual(token.get_token_string(), 'DQAAAGgAdk3fA5N') + self.assertTrue(isinstance(token, gdata.auth.ClientLoginToken)) + self.assertTrue(token.valid_for_scope('http://docs.google.com/feeds/')) + self.assertTrue(not token.valid_for_scope('http://www.blogger.com/feeds')) class ExtractOAuthTokensTest(unittest.TestCase): @@ -367,10 +367,10 @@ '%2Ffeeds%2F+http%3A%2F%2Fdocs.google.com%2Ffeeds%2F&' 'oauth_token=CMns6t7MCxDz__8B') token = gdata.auth.OAuthTokenFromUrl(url) - self.assertEquals('CMns6t7MCxDz__8B', token.key) - self.assertEquals(2, len(token.scopes)) - self.assert_(scope_1 in token.scopes) - self.assert_(scope_2 in token.scopes) + self.assertEqual('CMns6t7MCxDz__8B', token.key) + self.assertEqual(2, len(token.scopes)) + self.assertTrue(scope_1 in token.scopes) + self.assertTrue(scope_2 in token.scopes) # Case 2: token and scopes both are present but scope_param_prefix # passed does not match the one present in the URL. url = ('http://dummy.com/?oauth_token_scope=http%3A%2F%2Fwww.blogger.com' @@ -378,14 +378,14 @@ 'oauth_token=CMns6t7MCxDz__8B') token = gdata.auth.OAuthTokenFromUrl(url, scopes_param_prefix='token_scope') - self.assertEquals('CMns6t7MCxDz__8B', token.key) - self.assert_(not token.scopes) + self.assertEqual('CMns6t7MCxDz__8B', token.key) + self.assertTrue(not token.scopes) # Case 3: None present. url = ('http://dummy.com/?no_oauth_token_scope=http%3A%2F%2Fwww.blogger.com' '%2Ffeeds%2F+http%3A%2F%2Fdocs.google.com%2Ffeeds%2F&' 'no_oauth_token=CMns6t7MCxDz__8B') token = gdata.auth.OAuthTokenFromUrl(url) - self.assert_(token is None) + self.assertTrue(token is None) def testOAuthTokenFromHttpBody(self): token_key = 'ABCD' @@ -394,8 +394,8 @@ http_body = 'oauth_token=%s&oauth_token_secret=%s' % (token_key, token_secret) token = gdata.auth.OAuthTokenFromHttpBody(http_body) - self.assertEquals(token_key, token.key) - self.assertEquals(token_secret, token.secret) + self.assertEqual(token_key, token.key) + self.assertEqual(token_secret, token.secret) class OAuthInputParametersTest(unittest.TestCase): @@ -409,21 +409,21 @@ rsa_key=RSA_KEY) def testGetSignatureMethod(self): - self.assertEquals( + self.assertEqual( 'HMAC-SHA1', self.oauth_input_parameters_hmac.GetSignatureMethod().get_name()) rsa_signature_method = self.oauth_input_parameters_rsa.GetSignatureMethod() - self.assertEquals('RSA-SHA1', rsa_signature_method.get_name()) - self.assertEquals(RSA_KEY, rsa_signature_method._fetch_private_cert(None)) + self.assertEqual('RSA-SHA1', rsa_signature_method.get_name()) + self.assertEqual(RSA_KEY, rsa_signature_method._fetch_private_cert(None)) def testGetConsumer(self): - self.assertEquals(CONSUMER_KEY, + self.assertEqual(CONSUMER_KEY, self.oauth_input_parameters_hmac.GetConsumer().key) - self.assertEquals(CONSUMER_KEY, + self.assertEqual(CONSUMER_KEY, self.oauth_input_parameters_rsa.GetConsumer().key) - self.assertEquals(CONSUMER_SECRET, + self.assertEqual(CONSUMER_SECRET, self.oauth_input_parameters_hmac.GetConsumer().secret) - self.assert_(self.oauth_input_parameters_rsa.GetConsumer().secret is None) + self.assertTrue(self.oauth_input_parameters_rsa.GetConsumer().secret is None) class TokenClassesTest(unittest.TestCase): @@ -431,35 +431,35 @@ def testClientLoginToAndFromString(self): token = gdata.auth.ClientLoginToken() token.set_token_string('foo') - self.assertEquals(token.get_token_string(), 'foo') - self.assertEquals(token.auth_header, '%s%s' % ( + self.assertEqual(token.get_token_string(), 'foo') + self.assertEqual(token.auth_header, '%s%s' % ( gdata.auth.PROGRAMMATIC_AUTH_LABEL, 'foo')) token.set_token_string(token.get_token_string()) - self.assertEquals(token.get_token_string(), 'foo') + self.assertEqual(token.get_token_string(), 'foo') def testAuthSubToAndFromString(self): token = gdata.auth.AuthSubToken() token.set_token_string('foo') - self.assertEquals(token.get_token_string(), 'foo') - self.assertEquals(token.auth_header, '%s%s' % ( + self.assertEqual(token.get_token_string(), 'foo') + self.assertEqual(token.auth_header, '%s%s' % ( gdata.auth.AUTHSUB_AUTH_LABEL, 'foo')) token.set_token_string(token.get_token_string()) - self.assertEquals(token.get_token_string(), 'foo') + self.assertEqual(token.get_token_string(), 'foo') def testSecureAuthSubToAndFromString(self): # Case 1: no token. token = gdata.auth.SecureAuthSubToken(RSA_KEY) token.set_token_string('foo') - self.assertEquals(token.get_token_string(), 'foo') + self.assertEqual(token.get_token_string(), 'foo') token.set_token_string(token.get_token_string()) - self.assertEquals(token.get_token_string(), 'foo') - self.assertEquals(str(token), 'foo') + self.assertEqual(token.get_token_string(), 'foo') + self.assertEqual(str(token), 'foo') # Case 2: token is a string token = gdata.auth.SecureAuthSubToken(RSA_KEY, token_string='foo') - self.assertEquals(token.get_token_string(), 'foo') + self.assertEqual(token.get_token_string(), 'foo') token.set_token_string(token.get_token_string()) - self.assertEquals(token.get_token_string(), 'foo') - self.assertEquals(str(token), 'foo') + self.assertEqual(token.get_token_string(), 'foo') + self.assertEqual(str(token), 'foo') def testOAuthToAndFromString(self): token_key = 'ABCD' @@ -469,10 +469,10 @@ token_secret) token = gdata.auth.OAuthToken() token.set_token_string(token_string) - self.assert_(-1 < token.get_token_string().find(token_string.split('&')[0])) - self.assert_(-1 < token.get_token_string().find(token_string.split('&')[1])) - self.assertEquals(token_key, token.key) - self.assertEquals(token_secret, token.secret) + self.assertTrue(-1 < token.get_token_string().find(token_string.split('&')[0])) + self.assertTrue(-1 < token.get_token_string().find(token_string.split('&')[1])) + self.assertEqual(token_key, token.key) + self.assertEqual(token_secret, token.secret) # Case 2: token key and secret both present multiple times with unwanted # parameters. token_string = ('oauth_token=%s&oauth_token_secret=%s&' @@ -481,48 +481,48 @@ 'LMNO')) token = gdata.auth.OAuthToken() token.set_token_string(token_string) - self.assert_(-1 < token.get_token_string().find(token_string.split('&')[0])) - self.assert_(-1 < token.get_token_string().find(token_string.split('&')[1])) - self.assertEquals(token_key, token.key) - self.assertEquals(token_secret, token.secret) + self.assertTrue(-1 < token.get_token_string().find(token_string.split('&')[0])) + self.assertTrue(-1 < token.get_token_string().find(token_string.split('&')[1])) + self.assertEqual(token_key, token.key) + self.assertEqual(token_secret, token.secret) # Case 3: Only token key present. token_string = 'oauth_token=%s' % (token_key,) token = gdata.auth.OAuthToken() token.set_token_string(token_string) - self.assertEquals(token_string, token.get_token_string()) - self.assertEquals(token_key, token.key) - self.assert_(not token.secret) + self.assertEqual(token_string, token.get_token_string()) + self.assertEqual(token_key, token.key) + self.assertTrue(not token.secret) # Case 4: Only token key present. token_string = 'oauth_token_secret=%s' % (token_secret,) token = gdata.auth.OAuthToken() token.set_token_string(token_string) - self.assertEquals(token_string, token.get_token_string()) - self.assertEquals(token_secret, token.secret) - self.assert_(not token.key) + self.assertEqual(token_string, token.get_token_string()) + self.assertEqual(token_secret, token.secret) + self.assertTrue(not token.key) # Case 5: None present. token_string = '' token = gdata.auth.OAuthToken() token.set_token_string(token_string) - self.assert_(token.get_token_string() is None) - self.assert_(not token.key) - self.assert_(not token.secret) + self.assertTrue(token.get_token_string() is None) + self.assertTrue(not token.key) + self.assertTrue(not token.secret) def testSecureAuthSubGetAuthHeader(self): # Case 1: Presence of OAuth token (in case of 3-legged OAuth) url = 'http://dummy.com/?q=notebook&s=true' token = gdata.auth.SecureAuthSubToken(RSA_KEY, token_string='foo') auth_header = token.GetAuthHeader('GET', url) - self.assert_('Authorization' in auth_header) + self.assertTrue('Authorization' in auth_header) header_value = auth_header['Authorization'] - self.assert_(header_value.startswith(r'AuthSub token="foo"')) - self.assert_(-1 < header_value.find(r'sigalg="rsa-sha1"')) - self.assert_(-1 < header_value.find(r'data="')) - self.assert_(-1 < header_value.find(r'sig="')) + self.assertTrue(header_value.startswith(r'AuthSub token="foo"')) + self.assertTrue(-1 < header_value.find(r'sigalg="rsa-sha1"')) + self.assertTrue(-1 < header_value.find(r'data="')) + self.assertTrue(-1 < header_value.find(r'sig="')) m = re.search(r'data="(.*?)"', header_value) - self.assert_(m is not None) + self.assertTrue(m is not None) data = m.group(1) - self.assert_(data.startswith('GET')) - self.assert_(-1 < data.find(url)) + self.assertTrue(data.startswith('GET')) + self.assertTrue(-1 < data.find(url)) def testOAuthGetAuthHeader(self): # Case 1: Presence of OAuth token (in case of 3-legged OAuth) @@ -534,17 +534,17 @@ auth_header = token.GetAuthHeader('GET', 'http://dummy.com/?q=notebook&s=true', realm='http://dummy.com') - self.assert_('Authorization' in auth_header) + self.assertTrue('Authorization' in auth_header) header_value = auth_header['Authorization'] - self.assert_(-1 < header_value.find(r'OAuth realm="http://dummy.com"')) - self.assert_(-1 < header_value.find(r'oauth_version="1.0"')) - self.assert_(-1 < header_value.find(r'oauth_token="ABCDDSFFDSG"')) - self.assert_(-1 < header_value.find(r'oauth_nonce="')) - self.assert_(-1 < header_value.find(r'oauth_timestamp="')) - self.assert_(-1 < header_value.find(r'oauth_signature="')) - self.assert_(-1 < header_value.find( + self.assertTrue(-1 < header_value.find(r'OAuth realm="http://dummy.com"')) + self.assertTrue(-1 < header_value.find(r'oauth_version="1.0"')) + self.assertTrue(-1 < header_value.find(r'oauth_token="ABCDDSFFDSG"')) + self.assertTrue(-1 < header_value.find(r'oauth_nonce="')) + RefactoringTool: Refactored ./tests/gdata_tests/apps_test.py self.assertTrue(-1 < header_value.find(r'oauth_timestamp="')) + self.assertTrue(-1 < header_value.find(r'oauth_signature="')) + self.assertTrue(-1 < header_value.find( r'oauth_consumer_key="%s"' % CONSUMER_KEY)) - self.assert_(-1 < header_value.find(r'oauth_signature_method="RSA-SHA1"')) + self.assertTrue(-1 < header_value.find(r'oauth_signature_method="RSA-SHA1"')) # Case 2: Absence of OAuth token (in case of 2-legged OAuth) oauth_input_params = gdata.auth.OAuthInputParams( gdata.auth.OAuthSignatureMethod.HMAC_SHA1, CONSUMER_KEY, @@ -552,17 +552,17 @@ token = gdata.auth.OAuthToken(oauth_input_params=oauth_input_params) auth_header = token.GetAuthHeader( 'GET', 'http://dummy.com/?xoauth_requestor_id=user@gmail.com&q=book') - self.assert_('Authorization' in auth_header) + self.assertTrue('Authorization' in auth_header) header_value = auth_header['Authorization'] - self.assert_(-1 < header_value.find(r'OAuth realm=""')) - self.assert_(-1 < header_value.find(r'oauth_version="1.0"')) - self.assertEquals(-1, header_value.find(r'oauth_token=')) - self.assert_(-1 < header_value.find(r'oauth_nonce="')) - self.assert_(-1 < header_value.find(r'oauth_timestamp="')) - self.assert_(-1 < header_value.find(r'oauth_signature="')) - self.assert_(-1 < header_value.find( + self.assertTrue(-1 < header_value.find(r'OAuth realm=""')) + self.assertTrue(-1 < header_value.find(r'oauth_version="1.0"')) + self.assertEqual(-1, header_value.find(r'oauth_token=')) + self.assertTrue(-1 < header_value.find(r'oauth_nonce="')) + self.assertTrue(-1 < header_value.find(r'oauth_timestamp="')) + self.assertTrue(-1 < header_value.find(r'oauth_signature="')) + self.assertTrue(-1 < header_value.find( r'oauth_consumer_key="%s"' % CONSUMER_KEY)) - self.assert_(-1 < header_value.find(r'oauth_signature_method="HMAC-SHA1"')) + self.assertTrue(-1 < header_value.find(r'oauth_signature_method="HMAC-SHA1"')) if __name__ == '__main__': --- ./tests/gdata_tests/apps_test.py (original) +++ ./tests/gdata_tests/apps_test.py (refactored) @@ -36,36 +36,36 @@ def testEmailListRecipientEntryCount(self): """Count EmailListRecipient entries in EmailListRecipientFeed""" - self.assertEquals(len(self.rcpt_feed.entry), 2) - - def testLinkFinderFindsHtmlLink(self): - """Tests the return value of GetXXXLink() methods""" - - self.assert_(self.rcpt_feed.GetSelfLink() is not None) - self.assert_(self.rcpt_feed.GetNextLink() is not None) - self.assert_(self.rcpt_feed.GetEditLink() is None) - self.assert_(self.rcpt_feed.GetHtmlLink() is None) + self.assertEqual(len(self.rcpt_feed.entry), 2) + + def testLinkFinderFindsHtmlLink(self): + """Tests the return value of GetXXXLink() methods""" + + self.assertTrue(self.rcpt_feed.GetSelfLink() is not None) + self.assertTrue(self.rcpt_feed.GetNextLink() is not None) + self.assertTrue(self.rcpt_feed.GetEditLink() is None) + self.assertTrue(self.rcpt_feed.GetHtmlLink() is None) def testStartItem(self): """Tests the existence of in EmailListRecipientFeed and verifies the value""" - self.assert_(isinstance(self.rcpt_feed.start_index, gdata.StartIndex), + self.assertTrue(isinstance(self.rcpt_feed.start_index, gdata.StartIndex), "EmailListRecipient feed element must be " + "an instance of gdata.OpenSearch: %s" % self.rcpt_feed.start_index) - self.assertEquals(self.rcpt_feed.start_index.text, "1") + self.assertEqual(self.rcpt_feed.start_index.text, "1") def testEmailListRecipientEntries(self): """Tests the existence of in EmailListRecipientFeed and simply verifies the value""" for a_entry in self.rcpt_feed.entry: - self.assert_(isinstance(a_entry, gdata.apps.EmailListRecipientEntry), + self.assertTrue(isinstance(a_entry, gdata.apps.EmailListRecipientEntry), "EmailListRecipient Feed must be an instance of " + "apps.EmailListRecipientEntry: %s" % a_entry) - self.assertEquals(self.rcpt_feed.entry[0].who.email, "joe@example.com") - self.assertEquals(self.rcpt_feed.entry[1].who.email, "susan@example.com") + self.assertEqual(self.rcpt_feed.entry[0].who.email, "joe@example.com") + self.assertEqual(self.rcpt_feed.entry[1].who.email, "susan@example.com") class AppsEmailListFeedTest(unittest.TestCase): @@ -76,36 +76,36 @@ def testEmailListEntryCount(self): """Count EmailList entries in EmailListFeed""" - self.assertEquals(len(self.list_feed.entry), 2) - - def testLinkFinderFindsHtmlLink(self): - """Tests the return value of GetXXXLink() methods""" - - self.assert_(self.list_feed.GetSelfLink() is not None) - self.assert_(self.list_feed.GetNextLink() is not None) - self.assert_(self.list_feed.GetEditLink() is None) - self.assert_(self.list_feed.GetHtmlLink() is None) + self.assertEqual(len(self.list_feed.entry), 2) + + def testLinkFinderFindsHtmlLink(self): + """Tests the return value of GetXXXLink() methods""" + + self.assertTrue(self.list_feed.GetSelfLink() is not None) + self.assertTrue(self.list_feed.GetNextLink() is not None) + self.assertTrue(self.list_feed.GetEditLink() is None) + self.assertTrue(self.list_feed.GetHtmlLink() is None) def testStartItem(self): """Tests the existence of in EmailListFeed and verifies the value""" - self.assert_(isinstance(self.list_feed.start_index, gdata.StartIndex), + self.assertTrue(isinstance(self.list_feed.start_index, gdata.StartIndex), "EmailList feed element must be an instance " + "of gdata.OpenSearch: %s" % self.list_feed.start_index) - self.assertEquals(self.list_feed.start_index.text, "1") + self.assertEqual(self.list_feed.start_index.text, "1") def testUserEntries(self): """Tests the existence of in EmailListFeed and simply verifies the value""" for a_entry in self.list_feed.entry: - self.assert_(isinstance(a_entry, gdata.apps.EmailListEntry), + self.assertTrue(isinstance(a_entry, gdata.apps.EmailListEntry), "EmailList Feed must be an instance of " + "apps.EmailListEntry: %s" % a_entry) - self.assertEquals(self.list_feed.entry[0].email_list.name, "us-sales") - self.assertEquals(self.list_feed.entry[1].email_list.name, "us-eng") + self.assertEqual(self.list_feed.entry[0].email_list.name, "us-sales") + self.assertEqual(self.list_feed.entry[1].email_list.name, "us-eng") class AppsUserFeedTest(unittest.TestCase): @@ -115,39 +115,39 @@ def testUserEntryCount(self): """Count User entries in UserFeed""" - self.assertEquals(len(self.user_feed.entry), 2) - - def testLinkFinderFindsHtmlLink(self): - """Tests the return value of GetXXXLink() methods""" - - self.assert_(self.user_feed.GetSelfLink() is not None) - self.assert_(self.user_feed.GetNextLink() is not None) - self.assert_(self.user_feed.GetEditLink() is None) - self.assert_(self.user_feed.GetHtmlLink() is None) + self.assertEqual(len(self.user_feed.entry), 2) + + def testLinkFinderFindsHtmlLink(self): + """Tests the return value of GetXXXLink() methods""" + + self.assertTrue(self.user_feed.GetSelfLink() is not None) + self.assertTrue(self.user_feed.GetNextLink() is not None) + self.assertTrue(self.user_feed.GetEditLink() is None) + self.assertTrue(self.user_feed.GetHtmlLink() is None) def testStartItem(self): """Tests the existence of in UserFeed and verifies the value""" - self.assert_(isinstance(self.user_feed.start_index, gdata.StartIndex), + self.assertTrue(isinstance(self.user_feed.start_index, gdata.StartIndex), "User feed element must be an instance " + "of gdata.OpenSearch: %s" % self.user_feed.start_index) - self.assertEquals(self.user_feed.start_index.text, "1") + self.assertEqual(self.user_feed.start_index.text, "1") def testUserEntries(self): """Tests the existence of in UserFeed and simply verifies the value""" for a_entry in self.user_feed.entry: - self.assert_(isinstance(a_entry, gdata.apps.UserEntry), + self.assertTrue(isinstance(a_entry, gdata.apps.UserEntry), "User Feed must be an instance of " + "apps.UserEntry: %s" % a_entry) - self.assertEquals(self.user_feed.entry[0].login.user_name, "TestUser") - self.assertEquals(self.user_feed.entry[0].who.email, + self.assertEqual(self.user_feed.entry[0].login.user_name, "TestUser") + self.assertEqual(self.user_feed.entry[0].who.email, "TestUser@example.com") - self.assertEquals(self.user_feed.entry[1].login.user_name, "JohnSmith") - self.assertEquals(self.user_feed.entry[1].who.email, + self.assertEqual(self.user_feed.entry[1].login.user_name, "JohnSmith") + self.assertEqual(self.user_feed.entry[1].who.email, "JohnSmith@example.com") class AppsNicknameFeedTest(unittest.TestCase): @@ -158,56 +158,56 @@ def testNicknameEntryCount(self): """Count Nickname entries in NicknameFeed""" - self.assertEquals(len(self.nick_feed.entry), 2) + self.assertEqual(len(self.nick_feed.entry), 2) def testId(self): """Tests the existence of in NicknameFeed and verifies the value""" - self.assert_(isinstance(self.nick_feed.id, atom.Id), + self.assertTrue(isinstance(self.nick_feed.id, atom.Id), "Nickname feed element must be an instance of " + "atom.Id: %s" % self.nick_feed.id) - self.assertEquals(self.nick_feed.id.text, + self.assertEqual(self.nick_feed.id.text, "http://apps-apis.google.com/a/feeds/example.com/nickname/2.0") def testStartItem(self): """Tests the existence of in NicknameFeed and verifies the value""" - self.assert_(isinstance(self.nick_feed.start_index, gdata.StartIndex), + self.assertTrue(isinstance(self.nick_feed.start_index, gdata.StartIndex), "Nickname feed element must be an instance " + "of gdata.OpenSearch: %s" % self.nick_feed.start_index) - self.assertEquals(self.nick_feed.start_index.text, "1") + self.assertEqual(self.nick_feed.start_index.text, "1") def testItemsPerPage(self): """Tests the existence of in NicknameFeed and verifies the value""" - self.assert_(isinstance(self.nick_feed.items_per_page, gdata.ItemsPerPage), + self.assertTrue(isinstance(self.nick_feed.items_per_page, gdata.ItemsPerPage), "Nickname feed element must be an " + "instance of gdata.ItemsPerPage: %s" % self.nick_feed.items_per_page) - self.assertEquals(self.nick_feed.items_per_page.text, "2") - - def testLinkFinderFindsHtmlLink(self): - """Tests the return value of GetXXXLink() methods""" - - self.assert_(self.nick_feed.GetSelfLink() is not None) - self.assert_(self.nick_feed.GetEditLink() is None) - self.assert_(self.nick_feed.GetHtmlLink() is None) + self.assertEqual(self.nick_feed.items_per_page.text, "2") + + def testLinkFinderFindsHtmlLink(self): + """Tests the return value of GetXXXLink() methods""" + + self.assertTrue(self.nick_feed.GetSelfLink() is not None) + self.assertTrue(self.nick_feed.GetEditLink() is None) + self.assertTrue(self.nick_feed.GetHtmlLink() is None) def testNicknameEntries(self): """Tests the existence of in NicknameFeed and simply verifies the value""" for a_entry in self.nick_feed.entry: - self.assert_(isinstance(a_entry, gdata.apps.NicknameEntry), + self.assertTrue(isinstance(a_entry, gdata.apps.NicknameEntry), "Nickname Feed must be an instance of " + "apps.NicknameEntry: %s" % a_entry) - self.assertEquals(self.nick_feed.entry[0].nickname.name, "Foo") - self.assertEquals(self.nick_feed.entry[1].nickname.name, "Bar") + self.assertEqual(self.nick_feed.entry[0].nickname.name, "Foo") + self.assertEqual(self.nick_feed.entry[1].nickname.name, "Bar") class AppsEmailListRecipientEntryTest(unittest.TestCase): @@ -220,13 +220,13 @@ """Tests the existence of in EmailListRecipientEntry and verifies the value""" - self.assert_( + self.assertTrue( isinstance(self.rcpt_entry.id, atom.Id), "EmailListRecipient entry element must be an instance of " + "atom.Id: %s" % self.rcpt_entry.id) - self.assertEquals( + self.assertEqual( self.rcpt_entry.id.text, 'https://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/' + 'recipient/TestUser%40example.com') @@ -235,12 +235,12 @@ """Tests the existence of in EmailListRecipientEntry and verifies the value""" - self.assert_( + self.assertTrue( isinstance(self.rcpt_entry.updated, atom.Updated), "EmailListRecipient entry element must be an instance " + "of atom.Updated: %s" % self.rcpt_entry.updated) - self.assertEquals(self.rcpt_entry.updated.text, + self.assertEqual(self.rcpt_entry.updated.text, '1970-01-01T00:00:00.000Z') def testCategory(self): @@ -248,15 +248,15 @@ EmailListRecipientEntry and verifies the value""" for a_category in self.rcpt_entry.category: - self.assert_( + self.assertTrue( isinstance(a_category, atom.Category), "EmailListRecipient entry element must be an " + "instance of atom.Category: %s" % a_category) - self.assertEquals(a_category.scheme, + self.assertEqual(a_category.scheme, "http://schemas.google.com/g/2005#kind") - self.assertEquals(a_category.term, + self.assertEqual(a_category.term, "http://schemas.google.com/apps/2006#" + "emailList.recipient") @@ -264,28 +264,28 @@ """Tests the existence of in EmailListRecipientEntry and verifies the value""" - self.assert_( + self.assertTrue( isinstance(self.rcpt_entry.title, atom.Title), "EmailListRecipient entry element must be an instance of " + "atom.Title: %s" % self.rcpt_entry.title) - self.assertEquals(self.rcpt_entry.title.text, 'TestUser') - - def testLinkFinderFindsHtmlLink(self): - """Tests the return value of GetXXXLink() methods""" - - self.assert_(self.rcpt_entry.GetSelfLink() is not None) - self.assert_(self.rcpt_entry.GetEditLink() is not None) - self.assert_(self.rcpt_entry.GetHtmlLink() is None) + self.assertEqual(self.rcpt_entry.title.text, 'TestUser') + + def testLinkFinderFindsHtmlLink(self): + """Tests the return value of GetXXXLink() methods""" + + self.assertTrue(self.rcpt_entry.GetSelfLink() is not None) + self.assertTrue(self.rcpt_entry.GetEditLink() is not None) + self.assertTrue(self.rcpt_entry.GetHtmlLink() is None) def testWho(self): """Tests the existence of a in EmailListRecipientEntry and verifies the value""" - self.assert_(isinstance(self.rcpt_entry.who, gdata.apps.Who), + self.assertTrue(isinstance(self.rcpt_entry.who, gdata.apps.Who), "EmailListRecipient entry must be an instance of " + "apps.Who: %s" % self.rcpt_entry.who) - self.assertEquals(self.rcpt_entry.who.email, 'TestUser@example.com') + self.assertEqual(self.rcpt_entry.who.email, 'TestUser@example.com') class AppsEmailListEntryTest(unittest.TestCase): @@ -298,12 +298,12 @@ """Tests the existence of in EmailListEntry and verifies the value""" - self.assert_( + self.assertTrue( isinstance(self.list_entry.id, atom.Id), "EmailList entry element must be an instance of atom.Id: %s" % self.list_entry.id) - self.assertEquals( + self.assertEqual( self.list_entry.id.text, 'https://apps-apis.google.com/a/feeds/example.com/emailList/2.0/testlist') @@ -311,12 +311,12 @@ """Tests the existence of in EmailListEntry and verifies the value""" - self.assert_( + self.assertTrue( isinstance(self.list_entry.updated, atom.Updated), "EmailList entry element must be an instance of " + "atom.Updated: %s" % self.list_entry.updated) - self.assertEquals(self.list_entry.updated.text, + self.assertEqual(self.list_entry.updated.text, '1970-01-01T00:00:00.000Z') def testCategory(self): @@ -324,56 +324,56 @@ verifies the value""" for a_category in self.list_entry.category: - self.assert_( + self.assertTrue( isinstance(a_category, atom.Category), "EmailList entry element must be an instance " + "of atom.Category: %s" % a_category) - self.assertEquals(a_category.scheme, + self.assertEqual(a_category.scheme, "http://schemas.google.com/g/2005#kind") - self.assertEquals(a_category.term, + self.assertEqual(a_category.term, "http://schemas.google.com/apps/2006#emailList") def testTitle(self): """Tests the existence of in EmailListEntry and verifies the value""" - self.assert_( + self.assertTrue( isinstance(self.list_entry.title, atom.Title), "EmailList entry element must be an instance of " + "atom.Title: %s" % self.list_entry.title) - self.assertEquals(self.list_entry.title.text, 'testlist') - - def testLinkFinderFindsHtmlLink(self): - """Tests the return value of GetXXXLink() methods""" - - self.assert_(self.list_entry.GetSelfLink() is not None) - self.assert_(self.list_entry.GetEditLink() is not None) - self.assert_(self.list_entry.GetHtmlLink() is None) + self.assertEqual(self.list_entry.title.text, 'testlist') + + def testLinkFinderFindsHtmlLink(self): + """Tests the return value of GetXXXLink() methods""" + + self.assertTrue(self.list_entry.GetSelfLink() is not None) + self.assertTrue(self.list_entry.GetEditLink() is not None) + self.assertTrue(self.list_entry.GetHtmlLink() is None) def testEmailList(self): """Tests the existence of a in EmailListEntry and verifies the value""" - self.assert_(isinstance(self.list_entry.email_list, gdata.apps.EmailList), + self.assertTrue(isinstance(self.list_entry.email_list, gdata.apps.EmailList), "EmailList entry must be an instance of " + "apps.EmailList: %s" % self.list_entry.email_list) - self.assertEquals(self.list_entry.email_list.name, 'testlist') + self.assertEqual(self.list_entry.email_list.name, 'testlist') def testFeedLink(self): """Test the existence of a in EmailListEntry and verifies the value""" for an_feed_link in self.list_entry.feed_link: - self.assert_(isinstance(an_feed_link, gdata.FeedLink), + self.assertTrue(isinstance(an_feed_link, gdata.FeedLink), "EmailList entry must be an instance of " + "gdata.FeedLink: %s" % an_feed_link) - self.assertEquals(self.list_entry.feed_link[0].rel, + self.assertEqual(self.list_entry.feed_link[0].rel, 'http://schemas.google.com/apps/2006#' + 'emailList.recipients') - self.assertEquals(self.list_entry.feed_link[0].href, + self.assertEqual(self.list_entry.feed_link[0].href, 'http://apps-apis.google.com/a/feeds/example.com/emailList/' + '2.0/testlist/recipient/') @@ -386,12 +386,12 @@ """Tests the existence of in NicknameEntry and verifies the value""" - self.assert_( + self.assertTrue( isinstance(self.nick_entry.id, atom.Id), "Nickname entry element must be an instance of atom.Id: %s" % self.nick_entry.id) - self.assertEquals( + self.assertEqual( self.nick_entry.id.text, 'https://apps-apis.google.com/a/feeds/example.com/nickname/2.0/Foo') @@ -400,51 +400,51 @@ verifies the value""" for a_category in self.nick_entry.category: - self.assert_( + self.assertTrue( isinstance(a_category, atom.Category), "Nickname entry element must be an instance " + "of atom.Category: %s" % a_category) - self.assertEquals(a_category.scheme, + self.assertEqual(a_category.scheme, "http://schemas.google.com/g/2005#kind") - self.assertEquals(a_category.term, + self.assertEqual(a_category.term, "http://schemas.google.com/apps/2006#nickname") def testTitle(self): """Tests the existence of in NicknameEntry and verifies the value""" - self.assert_(isinstance(self.nick_entry.title, atom.Title), + self.assertTrue(isinstance(self.nick_entry.title, atom.Title), "Nickname entry element must be an instance " + "of atom.Title: %s" % self.nick_entry.title) - self.assertEquals(self.nick_entry.title.text, "Foo") + self.assertEqual(self.nick_entry.title.text, "Foo") def testLogin(self): """Tests the existence of in NicknameEntry and verifies the value""" - self.assert_(isinstance(self.nick_entry.login, gdata.apps.Login), + self.assertTrue(isinstance(self.nick_entry.login, gdata.apps.Login), "Nickname entry element must be an instance " + "of apps.Login: %s" % self.nick_entry.login) - self.assertEquals(self.nick_entry.login.user_name, "TestUser") + self.assertEqual(self.nick_entry.login.user_name, "TestUser") def testNickname(self): """Tests the existence of in NicknameEntry and verifies the value""" - self.assert_(isinstance(self.nick_entry.nickname, gdata.apps.Nickname), + self.assertTrue(isinstance(self.nick_entry.nickname, gdata.apps.Nickname), "Nickname entry element must be an instance " + "of apps.Nickname: %s" % self.nick_entry.nickname) - self.assertEquals(self.nick_entry.nickname.name, "Foo") - - def testLinkFinderFindsHtmlLink(self): - """Tests the return value of GetXXXLink() methods""" - - self.assert_(self.nick_entry.GetSelfLink() is not None) - self.assert_(self.nick_entry.GetEditLink() is not None) - self.assert_(self.nick_entry.GetHtmlLink() is None) + self.assertEqual(self.nick_entry.nickname.name, "Foo") + + def testLinkFinderFindsHtmlLink(self): + """Tests the return value of GetXXXLink() methods""" + + self.assertTrue(self.nick_entry.GetSelfLink() is not None) + self.assertTrue(self.nick_entry.GetEditLink() is not None) + self.assertTrue(self.nick_entry.GetHtmlLink() is None) class AppsUserEntryTest(unittest.TestCase): @@ -455,12 +455,12 @@ """Tests the existence of in UserEntry and verifies the value""" - self.assert_( + self.assertTrue( isinstance(self.user_entry.id, atom.Id), "User entry element must be an instance of atom.Id: %s" % self.user_entry.id) - self.assertEquals( + self.assertEqual( self.user_entry.id.text, 'https://apps-apis.google.com/a/feeds/example.com/user/2.0/TestUser') @@ -468,12 +468,12 @@ """Tests the existence of in UserEntry and verifies the value""" - self.assert_( + self.assertTrue( isinstance(self.user_entry.updated, atom.Updated), "User entry element must be an instance of " + "atom.Updated: %s" % self.user_entry.updated) - self.assertEquals(self.user_entry.updated.text, + self.assertEqual(self.user_entry.updated.text, '1970-01-01T00:00:00.000Z') def testCategory(self): @@ -481,84 +481,84 @@ verifies the value""" for a_category in self.user_entry.category: - self.assert_( + self.assertTrue( isinstance(a_category, atom.Category), "User entry element must be an instance " + "of atom.Category: %s" % a_category) - self.assertEquals(a_category.scheme, + self.assertEqual(a_category.scheme, "http://schemas.google.com/g/2005#kind") - self.assertEquals(a_category.term, + self.assertEqual(a_category.term, "http://schemas.google.com/apps/2006#user") def testTitle(self): """Tests the existence of in UserEntry and verifies the value""" - self.assert_( + self.assertTrue( isinstance(self.user_entry.title, atom.Title), "User entry element must be an instance of atom.Title: %s" % self.user_entry.title) - self.assertEquals(self.user_entry.title.text, 'TestUser') - - def testLinkFinderFindsHtmlLink(self): - """Tests the return value of GetXXXLink() methods""" - - self.assert_(self.user_entry.GetSelfLink() is not None) - self.assert_(self.user_entry.GetEditLink() is not None) - self.assert_(self.user_entry.GetHtmlLink() is None) + self.assertEqual(self.user_entry.title.text, 'TestUser') + + def testLinkFinderFindsHtmlLink(self): + """Tests the return value of GetXXXLink() methods""" + + self.assertTrue(self.user_entry.GetSelfLink() is not None) + self.assertTrue(self.user_entry.GetEditLink() is not None) + self.assertTrue(self.user_entry.GetHtmlLink() is None) def testLogin(self): """Tests the existence of in UserEntry and verifies the value""" - self.assert_(isinstance(self.user_entry.login, gdata.apps.Login), + self.assertTrue(isinstance(self.user_entry.login, gdata.apps.Login), "User entry element must be an instance of apps.Login: %s" % self.user_entry.login) - self.assertEquals(self.user_entry.login.user_name, 'TestUser') - self.assertEquals(self.user_entry.login.password, 'password') - self.assertEquals(self.user_entry.login.suspended, 'false') - self.assertEquals(self.user_entry.login.ip_whitelisted, 'false') - self.assertEquals(self.user_entry.login.hash_function_name, 'SHA-1') + self.assertEqual(self.user_entry.login.user_name, 'TestUser') + self.assertEqual(self.user_entry.login.password, 'password') + self.assertEqual(self.user_entry.login.suspended, 'false') + self.assertEqual(self.user_entry.login.ip_whitelisted, 'false') + self.assertEqual(self.user_entry.login.hash_function_name, 'SHA-1') def testName(self): """Tests the existence of in UserEntry and verifies the value""" - self.assert_(isinstance(self.user_entry.name, gdata.apps.Name), + self.assertTrue(isinstance(self.user_entry.name, gdata.apps.Name), "User entry element must be an instance of apps.Name: %s" % self.user_entry.name) - self.assertEquals(self.user_entry.name.family_name, 'Test') - self.assertEquals(self.user_entry.name.given_name, 'User') + self.assertEqual(self.user_entry.name.family_name, 'Test') + self.assertEqual(self.user_entry.name.given_name, 'User') def testQuota(self): """Tests the existence of in UserEntry and verifies the value""" - self.assert_(isinstance(self.user_entry.quota, gdata.apps.Quota), + self.assertTrue(isinstance(self.user_entry.quota, gdata.apps.Quota), "User entry element must be an instance of apps.Quota: %s" % self.user_entry.quota) - self.assertEquals(self.user_entry.quota.limit, '1024') + self.assertEqual(self.user_entry.quota.limit, '1024') def testFeedLink(self): """Test the existence of a in UserEntry and verifies the value""" for an_feed_link in self.user_entry.feed_link: - self.assert_(isinstance(an_feed_link, gdata.FeedLink), + self.assertTrue(isinstance(an_feed_link, gdata.FeedLink), "User entry must be an instance of gdata.FeedLink" + ": %s" % an_feed_link) - self.assertEquals(self.user_entry.feed_link[0].rel, + self.assertEqual(self.user_RefactoringTool: Refactored ./tests/gdata_tests/apps/service_test_using_mock.py RefactoringTool: Refactored ./tests/gdata_tests/apps/service_test.py entry.feed_link[0].rel, 'http://schemas.google.com/apps/2006#user.nicknames') - self.assertEquals(self.user_entry.feed_link[0].href, + self.assertEqual(self.user_entry.feed_link[0].href, 'https://apps-apis.google.com/a/feeds/example.com/nickname/' + '2.0?username=Test-3121') - self.assertEquals(self.user_entry.feed_link[1].rel, + self.assertEqual(self.user_entry.feed_link[1].rel, 'http://schemas.google.com/apps/2006#user.emailLists') - self.assertEquals(self.user_entry.feed_link[1].href, + self.assertEqual(self.user_entry.feed_link[1].href, 'https://apps-apis.google.com/a/feeds/example.com/emailList/' + '2.0?recipient=testlist@example.com') @@ -572,11 +572,11 @@ self.user_entry.login.suspended = 'true' modified = gdata.apps.UserEntryFromString(self.user_entry.ToString()) - self.assertEquals(modified.name.family_name, 'ModifiedFamilyName') - self.assertEquals(modified.name.given_name, 'ModifiedGivenName') - self.assertEquals(modified.quota.limit, '2048') - self.assertEquals(modified.login.password, 'ModifiedPassword') - self.assertEquals(modified.login.suspended, 'true') + self.assertEqual(modified.name.family_name, 'ModifiedFamilyName') + self.assertEqual(modified.name.given_name, 'ModifiedGivenName') + self.assertEqual(modified.quota.limit, '2048') + self.assertEqual(modified.login.password, 'ModifiedPassword') + self.assertEqual(modified.login.suspended, 'true') if __name__ == '__main__': unittest.main() --- ./tests/gdata_tests/apps/service_test_using_mock.py (original) +++ ./tests/gdata_tests/apps/service_test_using_mock.py (refactored) @@ -48,7 +48,7 @@ res.body = re.sub(r'SID=[^\n]+', 'SID=hogehoge', res.body) res.body = re.sub(r'LSID=[^\n]+', 'LSID=hogehoge', res.body) res.body = re.sub(r'Auth=[^\n]+', 'Auth=hogehoge', res.body) - if req.headers.has_key('Authorization'): + if 'Authorization' in req.headers: req.headers['Authorization'] = 'hogehoge' ret.append((req, res)) return ret @@ -93,7 +93,7 @@ for recipient_feed in generator: for a_recipient in recipient_feed.entry: i = i + 1 - self.assert_(i == 102) + self.assertTrue(i == 102) class AppsServiceTestForGetGeneratorForAllEmailLists(AppsServiceBaseTest, unittest.TestCase): @@ -105,7 +105,7 @@ for emaillist_feed in generator: for a_emaillist in emaillist_feed.entry: i = i + 1 - self.assert_(i == 105) + self.assertTrue(i == 105) class AppsServiceTestForGetGeneratorForAllNicknames(AppsServiceBaseTest, unittest.TestCase): @@ -117,7 +117,7 @@ for nickname_feed in generator: for a_nickname in nickname_feed.entry: i = i + 1 - self.assert_(i == 102) + self.assertTrue(i == 102) class AppsServiceTestForGetGeneratorForAllUsers(AppsServiceBaseTest, @@ -131,10 +131,10 @@ for user_feed in generator: for a_user in user_feed.entry: i = i + 1 - self.assert_(i == 102) + self.assertTrue(i == 102) if __name__ == '__main__': print ('The tests may delete or update your data.') - apps_username = raw_input('Please enter your username: ') + apps_username = input('Please enter your username: ') apps_password = getpass.getpass() unittest.main() --- ./tests/gdata_tests/apps/service_test.py (original) +++ ./tests/gdata_tests/apps/service_test.py (refactored) @@ -48,7 +48,7 @@ if self.created_user is not None: try: self.apps_client.DeleteUser(self.created_user.login.user_name) - except Exception, e: + except Exception as e: pass def test001RetrieveUser(self): @@ -58,10 +58,10 @@ self_user_entry = self.apps_client.RetrieveUser(apps_username) except: self.fail('Unexpected exception occurred') - self.assert_(isinstance(self_user_entry, gdata.apps.UserEntry), + self.assertTrue(isinstance(self_user_entry, gdata.apps.UserEntry), "The return value of RetrieveUser() must be an instance of " + "apps.UserEntry: %s" % self_user_entry) - self.assertEquals(self_user_entry.login.user_name, apps_username) + self.assertEqual(self_user_entry.login.user_name, apps_username) def test002RetrieveUserRaisesException(self): """Tests if RetrieveUser() raises AppsForYourDomainException with @@ -69,9 +69,9 @@ try: non_existance = self.apps_client.RetrieveUser('nobody-' + self.postfix) - except gdata.apps.service.AppsForYourDomainException, e: - self.assertEquals(e.error_code, gdata.apps.service.ENTITY_DOES_NOT_EXIST) - except Exception, e: + except gdata.apps.service.AppsForYourDomainException as e: + self.assertEqual(e.error_code, gdata.apps.service.ENTITY_DOES_NOT_EXIST) + except Exception as e: self.fail('Unexpected exception occurred: %s' % e) else: self.fail('No exception occurred') @@ -90,9 +90,9 @@ # Suspend then restore the new user. entry = self.apps_client.SuspendUser(created_user.login.user_name) - self.assertEquals(entry.login.suspended, 'true') + self.assertEqual(entry.login.suspended, 'true') entry = self.apps_client.RestoreUser(created_user.login.user_name) - self.assertEquals(entry.login.suspended, 'false') + self.assertEqual(entry.login.suspended, 'false') # Clean up, delete the test user. self.apps_client.DeleteUser(user_name) @@ -110,14 +110,14 @@ created_user = self.apps_client.CreateUser( user_name=user_name, family_name=family_name, given_name=given_name, password=password, suspended=suspended) - except Exception, e: - self.assert_(False, 'Unexpected exception occurred: %s' % e) + except Exception as e: + self.assertTrue(False, 'Unexpected exception occurred: %s' % e) self.created_user = created_user - self.assertEquals(created_user.login.user_name, user_name) - self.assertEquals(created_user.login.suspended, suspended) - self.assertEquals(created_user.name.family_name, family_name) - self.assertEquals(created_user.name.given_name, given_name) + self.assertEqual(created_user.login.user_name, user_name) + self.assertEqual(created_user.login.suspended, suspended) + self.assertEqual(created_user.name.family_name, family_name) + self.assertEqual(created_user.name.given_name, given_name) # self.assertEquals(created_user.quota.limit, # gdata.apps.service.DEFAULT_QUOTA_LIMIT) @@ -126,14 +126,14 @@ try: user_feed = self.apps_client.RetrieveAllUsers() - except Exception, e: - self.assert_(False, 'Unexpected exception occurred: %s' % e) + except Exception as e: + self.assertTrue(False, 'Unexpected exception occurred: %s' % e) succeed = False for a_entry in user_feed.entry: if a_entry.login.user_name == user_name: succeed = True - self.assert_(succeed, 'There must be a user: %s' % user_name) + self.assertTrue(succeed, 'There must be a user: %s' % user_name) """Tests UpdateUser method""" @@ -148,15 +148,15 @@ try: new_user_entry = self.apps_client.UpdateUser(user_name, created_user) - except Exception, e: + except Exception as e: self.fail('Unexpected exception occurred: %s' % e) - self.assert_(isinstance(new_user_entry, gdata.apps.UserEntry), + self.assertTrue(isinstance(new_user_entry, gdata.apps.UserEntry), "new user entry must be an instance of gdata.apps.UserEntry: %s" % new_user_entry) - self.assertEquals(new_user_entry.name.family_name, new_family_name) - self.assertEquals(new_user_entry.name.given_name, new_given_name) - self.assertEquals(new_user_entry.login.suspended, 'true') + self.assertEqual(new_user_entry.name.family_name, new_family_name) + self.assertEqual(new_user_entry.name.given_name, new_given_name) + self.assertEqual(new_user_entry.login.suspended, 'true') # quota limit update does not always success. # self.assertEquals(new_user_entry.quota.limit, new_quota) @@ -168,9 +168,9 @@ # make sure that there is no account with nobody- + self.postfix try: tmp_entry = self.apps_client.RetrieveUser('nobody-' + self.postfix) - except gdata.apps.service.AppsForYourDomainException, e: - self.assertEquals(e.error_code, gdata.apps.service.ENTITY_DOES_NOT_EXIST) - except Exception, e: + except gdata.apps.service.AppsForYourDomainException as e: + self.assertEqual(e.error_code, gdata.apps.service.ENTITY_DOES_NOT_EXIST) + except Exception as e: self.fail('Unexpected exception occurred: %s' % e) else: self.fail('No exception occurred') @@ -179,9 +179,9 @@ try: new_user_entry = self.apps_client.UpdateUser('nobody-' + self.postfix, nobody) - except gdata.apps.service.AppsForYourDomainException, e: - self.assertEquals(e.error_code, gdata.apps.service.ENTITY_DOES_NOT_EXIST) - except Exception, e: + except gdata.apps.service.AppsForYourDomainException as e: + self.assertEqual(e.error_code, gdata.apps.service.ENTITY_DOES_NOT_EXIST) + except Exception as e: self.fail('Unexpected exception occurred: %s' % e) else: self.fail('No exception occurred') @@ -190,15 +190,15 @@ try: self.apps_client.DeleteUser(user_name) - except Exception, e: - self.assert_(False, 'Unexpected exception occurred: %s' % e) + except Exception as e: + self.assertTrue(False, 'Unexpected exception occurred: %s' % e) # make sure that the account deleted try: self.apps_client.RetrieveUser(user_name) - except gdata.apps.service.AppsForYourDomainException, e: - self.assertEquals(e.error_code, gdata.apps.service.ENTITY_DOES_NOT_EXIST) - except Exception, e: + except gdata.apps.service.AppsForYourDomainException as e: + self.assertEqual(e.error_code, gdata.apps.service.ENTITY_DOES_NOT_EXIST) + except Exception as e: self.fail('Unexpected exception occurred: %s' % e) else: self.fail('No exception occurred') @@ -207,9 +207,9 @@ # make sure that DeleteUser fails with AppsForYourDomainException. try: self.apps_client.DeleteUser(user_name) - except gdata.apps.service.AppsForYourDomainException, e: - self.assertEquals(e.error_code, gdata.apps.service.ENTITY_DOES_NOT_EXIST) - except Exception, e: + except gdata.apps.service.AppsForYourDomainException as e: + self.assertEqual(e.error_code, gdata.apps.service.ENTITY_DOES_NOT_EXIST) + except Exception as e: self.fail('Unexpected exception occurred: %s' % e) else: self.fail('No exception occurred') @@ -228,7 +228,7 @@ created_user = self.apps_client.CreateUser( user_name=user_name, family_name=family_name, given_name=given_name, password=password, suspended=suspended) - except Exception, e: + except Exception as e: self.fail('Unexpected exception occurred: %s' % e) self.created_user = created_user @@ -236,34 +236,34 @@ nickname = 'emmy-' + self.postfix try: created_nickname = self.apps_client.CreateNickname(user_name, nickname) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assert_(isinstance(created_nickname, gdata.apps.NicknameEntry), + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertTrue(isinstance(created_nickname, gdata.apps.NicknameEntry), "Return value of CreateNickname method must be an instance of " + "gdata.apps.NicknameEntry: %s" % created_nickname) - self.assertEquals(created_nickname.login.user_name, user_name) - self.assertEquals(created_nickname.nickname.name, nickname) + self.assertEqual(created_nickname.login.user_name, user_name) + self.assertEqual(created_nickname.nickname.name, nickname) # tests RetrieveNickname method retrieved_nickname = self.apps_client.RetrieveNickname(nickname) - self.assert_(isinstance(retrieved_nickname, gdata.apps.NicknameEntry), + self.assertTrue(isinstance(retrieved_nickname, gdata.apps.NicknameEntry), "Return value of RetrieveNickname method must be an instance of " + "gdata.apps.NicknameEntry: %s" % retrieved_nickname) - self.assertEquals(retrieved_nickname.login.user_name, user_name) - self.assertEquals(retrieved_nickname.nickname.name, nickname) + self.assertEqual(retrieved_nickname.login.user_name, user_name) + self.assertEqual(retrieved_nickname.nickname.name, nickname) # tests RetrieveNicknames method nickname_feed = self.apps_client.RetrieveNicknames(user_name) - self.assert_(isinstance(nickname_feed, gdata.apps.NicknameFeed), + self.assertTrue(isinstance(nickname_feed, gdata.apps.NicknameFeed), "Return value of RetrieveNicknames method must be an instance of " + "gdata.apps.NicknameFeed: %s" % nickname_feed) - self.assertEquals(nickname_feed.entry[0].login.user_name, user_name) - self.assertEquals(nickname_feed.entry[0].nickname.name, nickname) + self.assertEqual(nickname_feed.entry[0].login.user_name, user_name) + self.assertEqual(nickname_feed.entry[0].nickname.name, nickname) # tests RetrieveAllNicknames method nickname_feed = self.apps_client.RetrieveAllNicknames() - self.assert_(isinstance(nickname_feed, gdata.apps.NicknameFeed), + self.assertTrue(isinstance(nickname_feed, gdata.apps.NicknameFeed), "Return value of RetrieveAllNicknames method must be an instance of " + "gdata.apps.NicknameFeed: %s" % nickname_feed) succeed = False @@ -271,16 +271,16 @@ if a_entry.login.user_name == user_name and \ a_entry.nickname.name == nickname: succeed = True - self.assert_(succeed, + self.assertTrue(succeed, "There must be a nickname entry named %s." % nickname) # tests DeleteNickname method self.apps_client.DeleteNickname(nickname) try: non_existence = self.apps_client.RetrieveNickname(nickname) - except gdata.apps.service.AppsForYourDomainException, e: - self.assertEquals(e.error_code, gdata.apps.service.ENTITY_DOES_NOT_EXIST) - except Exception, e: + except gdata.apps.service.AppsForYourDomainException as e: + self.assertEqual(e.error_code, gdata.apps.service.ENTITY_DOES_NOT_EXIST) + except Exception as e: self.fail('Unexpected exception occurred: %s' % e) else: self.fail('No exception occurred') @@ -301,13 +301,13 @@ for user in self.created_users: try: self.apps_client.DeleteUser(user.login.user_name) - except Exception, e: - print e + except Exception as e: + print(e) for email_list in self.created_email_lists: try: self.apps_client.DeleteEmailList(email_list.email_list.name) - except Exception, e: - print e + except Exception as e: + print(e) def test001MethodsForEmaillist(self): """Tests methods for emaillist """ @@ -322,7 +322,7 @@ user_yuji = self.apps_client.CreateUser( user_name=user_name, family_name=family_name, given_name=given_name, password=password, suspended=suspended) - except Exception, e: + except Exception as e: self.fail('Unexpected exception occurred: %s' % e) self.created_users.append(user_yuji) @@ -337,7 +337,7 @@ user_taro = self.apps_client.CreateUser( user_name=user_name, family_name=family_name, given_name=given_name, password=password, suspended=suspended) - except Exception, e: + except Exception as e: self.fail('Unexpected exception occurred: %s' % e) self.created_users.append(user_taro) @@ -346,13 +346,13 @@ list_name = 'list01-' + self.postfix try: created_email_list = self.apps_client.CreateEmailList(list_name) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assert_(isinstance(created_email_list, gdata.apps.EmailListEntry), + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertTrue(isinstance(created_email_list, gdata.apps.EmailListEntry), "Return value of CreateEmailList method must be an instance of " + "EmailListEntry: %s" % created_email_list) - self.assertEquals(created_email_list.email_list.name, list_name) + self.assertEqual(created_email_list.email_list.name, list_name) self.created_email_lists.append(created_email_list) # tests AddRecipientToEmailList method @@ -360,86 +360,86 @@ recipient = self.apps_client.AddRecipientToEmailList( user_yuji.login.user_name + '@' + apps_domain, list_name) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assert_(isinstance(recipient, gdata.apps.EmailListRecipientEntry), + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertTrue(isinstance(recipient, gdata.apps.EmailListRecipientEntry), "Return value of AddRecipientToEmailList method must be an instance " + "of EmailListRecipientEntry: %s" % recipient) - self.assertEquals(recipient.who.email, + self.assertEqual(recipient.who.email, user_yuji.login.user_name + '@' + apps_domain) try: recipient = self.apps_client.AddRecipientToEmailList( user_taro.login.user_name + '@' + apps_domain, list_name) - except Exception, e: + except Exception as e: self.fail('Unexpected exception occurred: %s' % e) # tests RetrieveAllRecipients method try: recipient_feed = self.apps_client.RetrieveAllRecipients(list_name) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assert_(isinstance(recipient_feed, gdata.apps.EmailListRecipientFeed), + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertTrue(isinstance(recipient_feed, gdata.apps.EmailListRecipientFeed), "Return value of RetrieveAllRecipients method must be an instance " + "of EmailListRecipientFeed: %s" % recipient_feed) - self.assertEquals(len(recipient_feed.entry), 2) + self.assertEqual(len(recipient_feed.entry), 2) # tests RemoveRecipientFromEmailList method try: self.apps_client.RemoveRecipientFromEmailList( user_taro.login.user_name + '@' + apps_domain, list_name) - except Exception, e: + except Exception as e: self.fail('Unexpected exception occurred: %s' % e) # make sure that removal succeeded. try: recipient_feed = self.apps_client.RetrieveAllRecipients(list_name) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assert_(isinstance(recipient_feed, gdata.apps.EmailListRecipientFeed), + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertTrue(isinstance(recipient_feed, gdata.apps.EmailListRecipientFeed), "Return value of RetrieveAllRecipients method must be an instance " + "of EmailListRecipientFeed: %s" % recipient_feed) - self.assertEquals(len(recipient_feed.entry), 1) + self.assertEqual(len(recipient_feed.entry), 1) # tests RetrieveAllEmailLists try: list_feed = self.apps_client.RetrieveAllEmailLists() - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - self.assert_(isinstance(list_feed, gdata.apps.EmailListFeed), + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + self.assertTrue(isinstance(list_feed, gdata.apps.EmailListFeed), "Return value of RetrieveAllEmailLists method must be an instance" + "of EmailListFeed: %s" % list_feed) succeed = False for email_list in list_feed.entry: if email_list.email_list.name == list_name: succeed = True - self.assert_(succeed, "There must be an email list named %s" % list_name) + self.assertTrue(succeed, "There must be an email list named %RefactoringTool: Refactored ./tests/gdata_tests/apps/organization/service_test.py s" % list_name) # tests RetrieveEmailLists method. try: list_feed = self.apps_client.RetrieveEmailLists( user_yuji.login.user_name + '@' + apps_domain) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - self.assert_(isinstance(list_feed, gdata.apps.EmailListFeed), + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + self.assertTrue(isinstance(list_feed, gdata.apps.EmailListFeed), "Return value of RetrieveEmailLists method must be an instance" + "of EmailListFeed: %s" % list_feed) succeed = False for email_list in list_feed.entry: if email_list.email_list.name == list_name: succeed = True - self.assert_(succeed, "There must be an email list named %s" % list_name) + self.assertTrue(succeed, "There must be an email list named %s" % list_name) def testRetrieveEmailList(self): new_list = self.apps_client.CreateEmailList('my_testing_email_list') retrieved_list = self.apps_client.RetrieveEmailList('my_testing_email_list') - self.assertEquals(new_list.title.text, retrieved_list.title.text) - self.assertEquals(new_list.id.text, retrieved_list.id.text) - self.assertEquals(new_list.email_list.name, retrieved_list.email_list.name) + self.assertEqual(new_list.title.text, retrieved_list.title.text) + self.assertEqual(new_list.id.text, retrieved_list.id.text) + self.assertEqual(new_list.email_list.name, retrieved_list.email_list.name) self.apps_client.DeleteEmailList('my_testing_email_list') @@ -467,13 +467,13 @@ for user in self.created_users: try: self.apps_client.DeleteUser(user.login.user_name) - except Exception, e: - print e + except Exception as e: + print(e) for email_list in self.created_email_lists: try: self.apps_client.DeleteEmailList(email_list.email_list.name) - except Exception, e: - print e + except Exception as e: + print(e) def test001Pagenation(self): """Tests for pagination. It takes toooo long.""" @@ -485,18 +485,18 @@ list_name = 'list%03d-' % i + self.postfix try: created_email_list = self.apps_client.CreateEmailList(list_name) - except Exception, e: + except Exception as e: self.fail('Unexpected exception occurred: %s' % e) self.created_email_lists.append(created_email_list) list_feed = self.apps_client.RetrieveAllEmailLists() - self.assertEquals(len(list_feed.entry), list_nums + quantity) + self.assertEqual(len(list_feed.entry), list_nums + quantity) if __name__ == '__main__': print ('Google Apps Service Tests\nNOTE: Please run these tests only with ' 'a test domain. The tests may delete or update your domain\'s ' 'account data.') - apps_domain = raw_input('Please enter your domain: ') - apps_username = raw_input('Please enter your username of admin account: ') + apps_domain = input('Please enter your domain: ') + apps_username = input('Please enter your username of admin account: ') apps_password = getpass.getpass() unittest.main() --- ./tests/gdata_tests/apps/organization/service_test.py (original) +++ ./tests/gdata_tests/apps/organization/service_test.py (refactored) @@ -20,7 +20,7 @@ __author__ = 'Alexandre Vivien (alex@simplecode.fr)' -import urllib +import urllib.request, urllib.parse, urllib.error import unittest try: from xml.etree import ElementTree @@ -71,8 +71,8 @@ given_name=given_name, password=password, suspended=suspended) - print 'User ' + user_name + ' created' - except Exception, e: + print('User ' + user_name + ' created') + except Exception as e: self.fail('Unexpected exception occurred: %s' % e) self.created_users.append(self.user_yuji) @@ -89,8 +89,8 @@ given_name=given_name, password=password, suspended=suspended) - print 'User ' + user_name + ' created' - except Exception, e: + print('User ' + user_name + ' created') + except Exception as e: self.fail('Unexpected exception occurred: %s' % e) self.created_users.append(self.user_taro) @@ -107,28 +107,28 @@ given_name=given_name, password=password, suspended=suspended) - print 'User ' + user_name + ' created' - except Exception, e: + print('User ' + user_name + ' created') + except Exception as e: self.fail('Unexpected exception occurred: %s' % e) self.created_users.append(self.user_alex) def tearDown(self): - print '\n' + print('\n') for user in self.created_users: try: self.apps_client.DeleteUser(user.login.user_name) - print 'User ' + user.login.user_name + ' deleted' - except Exception, e: - print e + print('User ' + user.login.user_name + ' deleted') + except Exception as e: + print(e) # We reverse to delete sub OrgUnit first self.created_org_units.reverse() for org_unit_path in self.created_org_units: try: self.organization_client.DeleteOrgUnit(self.customer_id, org_unit_path) - print 'OrgUnit ' + org_unit_path + ' deleted' - except Exception, e: - print e + print('OrgUnit ' + org_unit_path + ' deleted') + except Exception as e: + print(e) def testOrganizationService(self): @@ -136,9 +136,9 @@ try: customer = self.organization_client.RetrieveCustomerId() self.customer_id = customer['customerId'] - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - print 'tests RetrieveCustomerId successful' + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + print('tests RetrieveCustomerId successful') # tests CreateOrgUnit method orgUnit01_name = 'OrgUnit01-' + self.postfix @@ -166,29 +166,29 @@ parent_org_unit_path='/', description='OrgUnit Test 03', block_inheritance=False) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assertEquals(orgUnit01['orgUnitPath'], urllib.quote_plus(orgUnit01_name)) - self.assertEquals(orgUnit02['orgUnitPath'], urllib.quote_plus(orgUnit02_name)) - self.assertEquals(sub0rgUnit01['orgUnitPath'], urllib.quote_plus(orgUnit02_name) + '/' + urllib.quote_plus(sub0rgUnit01_name)) - self.assertEquals(orgUnit03['orgUnitPath'], urllib.quote_plus(orgUnit03_name)) + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertEqual(orgUnit01['orgUnitPath'], urllib.parse.quote_plus(orgUnit01_name)) + self.assertEqual(orgUnit02['orgUnitPath'], urllib.parse.quote_plus(orgUnit02_name)) + self.assertEqual(sub0rgUnit01['orgUnitPath'], urllib.parse.quote_plus(orgUnit02_name) + '/' + urllib.parse.quote_plus(sub0rgUnit01_name)) + self.assertEqual(orgUnit03['orgUnitPath'], urllib.parse.quote_plus(orgUnit03_name)) self.created_org_units.append(orgUnit01['orgUnitPath']) self.created_org_units.append(orgUnit02['orgUnitPath']) self.created_org_units.append(sub0rgUnit01['orgUnitPath']) self.created_org_units.append(orgUnit03['orgUnitPath']) - print 'tests CreateOrgUnit successful' + print('tests CreateOrgUnit successful') # tests UpdateOrgUnit method try: updated_orgunit = self.organization_client.UpdateOrgUnit(self.customer_id, org_unit_path=self.created_org_units[3], description='OrgUnit Test 03 Updated description') - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assertEquals(updated_orgunit['orgUnitPath'], self.created_org_units[3]) - print 'tests UpdateOrgUnit successful' + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertEqual(updated_orgunit['orgUnitPath'], self.created_org_units[3]) + print('tests UpdateOrgUnit successful') # tests RetrieveOrgUnit method try: @@ -196,21 +196,21 @@ org_unit_path=self.created_org_units[1]) retrieved_suborgunit = self.organization_client.RetrieveOrgUnit(self.customer_id, org_unit_path=self.created_org_units[2]) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assertEquals(retrieved_orgunit['orgUnitPath'], self.created_org_units[1]) - self.assertEquals(retrieved_suborgunit['orgUnitPath'], self.created_org_units[2]) - print 'tests RetrieveOrgUnit successful' + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertEqual(retrieved_orgunit['orgUnitPath'], self.created_org_units[1]) + self.assertEqual(retrieved_suborgunit['orgUnitPath'], self.created_org_units[2]) + print('tests RetrieveOrgUnit successful') # tests RetrieveAllOrgUnits method try: retrieved_orgunits = self.organization_client.RetrieveAllOrgUnits(self.customer_id) - except Exception, e: + except Exception as e: self.fail('Unexpected exception occurred: %s' % e) self.assertTrue(len(retrieved_orgunits) >= len(self.created_org_units)) - print 'tests RetrieveAllOrgUnits successful' + print('tests RetrieveAllOrgUnits successful') # tests MoveUserToOrgUnit method try: @@ -221,56 +221,56 @@ org_unit_path=self.created_org_units[1], users_to_move=[self.user_taro.login.user_name + '@' + domain, self.user_alex.login.user_name + '@' + domain]) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assertEquals(updated_orgunit01['usersMoved'], self.user_yuji.login.user_name + '@' + domain) - self.assertEquals(updated_orgunit02['usersMoved'], self.user_taro.login.user_name + '@' + domain + ',' + \ + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertEqual(updated_orgunit01['usersMoved'], self.user_yuji.login.user_name + '@' + domain) + self.assertEqual(updated_orgunit02['usersMoved'], self.user_taro.login.user_name + '@' + domain + ',' + \ self.user_alex.login.user_name + '@' + domain) - print 'tests MoveUserToOrgUnit successful' + print('tests MoveUserToOrgUnit successful') # tests RetrieveSubOrgUnits method try: retrieved_suborgunits = self.organization_client.RetrieveSubOrgUnits(self.customer_id, org_unit_path=self.created_org_units[1]) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assertEquals(len(retrieved_suborgunits), 1) - self.assertEquals(retrieved_suborgunits[0]['orgUnitPath'], self.created_org_units[2]) - print 'tests RetrieveSubOrgUnits successful' + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertEqual(len(retrieved_suborgunits), 1) + self.assertEqual(retrieved_suborgunits[0]['orgUnitPath'], self.created_org_units[2]) + print('tests RetrieveSubOrgUnits successful') # tests RetrieveOrgUser method trRefactoringTool: Refactored ./tests/gdata_tests/apps/organization/live_client_test.py y: retrieved_orguser = self.organization_client.RetrieveOrgUser(self.customer_id, user_email=self.user_yuji.login.user_name + '@' + domain) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assertEquals(retrieved_orguser['orgUserEmail'], self.user_yuji.login.user_name + '@' + domain) - self.assertEquals(retrieved_orguser['orgUnitPath'], self.created_org_units[0]) - print 'tests RetrieveOrgUser successful' + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertEqual(retrieved_orguser['orgUserEmail'], self.user_yuji.login.user_name + '@' + domain) + self.assertEqual(retrieved_orguser['orgUnitPath'], self.created_org_units[0]) + print('tests RetrieveOrgUser successful') # tests UpdateOrgUser method try: updated_orguser = self.organization_client.UpdateOrgUser(self.customer_id, org_unit_path=self.created_org_units[0], user_email=self.user_alex.login.user_name + '@' + domain) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assertEquals(updated_orguser['orgUserEmail'], self.user_alex.login.user_name + '@' + domain) - self.assertEquals(updated_orguser['orgUnitPath'], self.created_org_units[0]) - print 'tests UpdateOrgUser successful' + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertEqual(updated_orguser['orgUserEmail'], self.user_alex.login.user_name + '@' + domain) + self.assertEqual(updated_orguser['orgUnitPath'], self.created_org_units[0]) + print('tests UpdateOrgUser successful') # tests RetrieveAllOrgUsers method try: retrieved_orgusers = self.organization_client.RetrieveAllOrgUsers(self.customer_id) - except Exception, e: + except Exception as e: self.fail('Unexpected exception occurred: %s' % e) self.assertTrue(len(retrieved_orgusers) >= len(self.created_users)) - print 'tests RetrieveAllOrgUsers successful' + print('tests RetrieveAllOrgUsers successful') """ This test needs to create more than 100 test users # tests RetrievePageOfOrgUsers method @@ -293,11 +293,11 @@ try: retrieved_orgusers = self.organization_client.RetrieveOrgUnitUsers(self.customer_id, org_unit_path=self.created_org_units[0]) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assertEquals(len(retrieved_orgusers), 2) - print 'tests RetrieveOrgUnitUsers successful' + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertEqual(len(retrieved_orgusers), 2) + print('tests RetrieveOrgUnitUsers successful') """ This test needs to create more than 100 test users # tests RetrieveOrgUnitPageOfUsers method @@ -324,7 +324,7 @@ NOTE: Please run these tests only with a test user account. """) - domain = raw_input('Google Apps domain: ') - admin_email = '%s@%s' % (raw_input('Administrator username: '), domain) + domain = input('Google Apps domain: ') + admin_email = '%s@%s' % (input('Administrator username: '), domain) admin_password = getpass.getpass('Administrator password: ') unittest.main() --- ./tests/gdata_tests/apps/organization/live_client_test.py (original) +++ ./tests/gdata_tests/apps/organization/live_client_test.py (refactored) @@ -117,18 +117,18 @@ parent_org_unit_path='/', description=org_unit_description, block_inheritance=False) - self.assert_(isinstance(new_entry, + self.assertTrue(isinstance(new_entry, gdata.apps.organization.data.OrgUnitEntry)) - self.assertEquals(new_entRefactoringTool: Refactored ./tests/gdata_tests/apps/organization/data_test.py ry.org_unit_path, org_unit_path) + self.assertEqual(new_entry.org_unit_path, org_unit_path) entry = self.client.RetrieveOrgUnit(customer_id, org_unit_path) - self.assert_(isinstance(entry, + self.assertTrue(isinstance(entry, gdata.apps.organization.data.OrgUnitEntry)) - self.assertEquals(entry.org_unit_name, org_unit_name) - self.assertEquals(entry.org_unit_description, org_unit_description) - self.assertEquals(entry.parent_org_unit_path, '') - self.assertEquals(entry.org_unit_path, org_unit_path) - self.assertEquals(entry.org_unit_block_inheritance, 'false') + self.assertEqual(entry.org_unit_name, org_unit_name) + self.assertEqual(entry.org_unit_description, org_unit_description) + self.assertEqual(entry.parent_org_unit_path, '') + self.assertEqual(entry.org_unit_path, org_unit_path) + self.assertEqual(entry.org_unit_block_inheritance, 'false') self.client.DeleteOrgUnit(customer_id, org_unit_name) --- ./tests/gdata_tests/apps/organization/data_test.py (original) +++ ./tests/gdata_tests/apps/organization/data_test.py (refactored) @@ -34,13 +34,13 @@ gdata.apps.organization.data.CustomerIdEntry) def testCustomerIdEntryFromString(self): - self.assert_(isinstance(self.entry, + self.assertTrue(isinstance(self.entry, gdata.apps.organization.data.CustomerIdEntry)) - self.assertEquals(self.entry.customer_id, 'C123A456B') - self.assertEquals(self.entry.customer_org_unit_name, 'example.com') - self.assertEquals(self.entry.customer_org_unit_description, 'example.com') - self.assertEquals(self.entry.org_unit_name, 'example.com') - self.assertEquals(self.entry.org_unit_description, 'tempdescription') + self.assertEqual(self.entry.customer_id, 'C123A456B') + self.assertEqual(self.entry.customer_org_unit_name, 'example.com') + self.assertEqual(self.entry.customer_org_unit_description, 'example.com') + self.assertEqual(self.entry.org_unit_name, 'example.com') + self.assertEqual(self.entry.org_unit_description, 'tempdescription') class OrgUnitEntryTest(unittest.TestCase): @@ -52,40 +52,40 @@ gdata.apps.organization.data.OrgUnitFeed) def testOrgUnitEntryFromString(self): - self.assert_(isinstance(self.entry, + self.assertTrue(isinstance(self.entry, gdata.apps.organization.data.OrgUnitEntry)) - self.assertEquals(self.entry.org_unit_description, 'New Test Org') - self.assertEquals(self.entry.org_unit_name, 'Test Organization') - self.assertEquals(self.entry.org_unit_path, 'Test/Test+Organization') - self.assertEquals(self.entry.parent_org_unit_path, 'Test') - self.assertEquals(self.entry.org_unit_block_inheritance, 'false') + self.assertEqual(self.entry.org_unit_description, 'New Test Org') + self.assertEqual(self.entry.org_unit_name, 'Test Organization') + self.assertEqual(self.entry.org_unit_path, 'Test/Test+Organization') + self.assertEqual(self.entry.parent_org_unit_path, 'Test') + self.assertEqual(self.entry.org_unit_block_inheritance, 'false') def testOrgUnitFeedFromString(self): - self.assertEquals(len(self.feed.entry), 2) - self.assert_(isinstance(self.feed, + self.assertEqual(len(self.feed.entry), 2) + self.assertTrue(isinstance(self.feed, gdata.apps.organization.data.OrgUnitFeed)) - self.assert_(isinstance(self.feed.entry[0], + self.assertTrue(isinstance(self.feed.entry[0], gdata.apps.organization.data.OrgUnitEntry)) - self.assert_(isinstance(self.feed.entry[1], + self.assertTrue(isinstance(self.feed.entry[1], gdata.apps.organization.data.OrgUnitEntry)) - self.assertEquals( + self.assertEqual( self.feed.entry[0].find_edit_link(), ('https://apps-apis.google.com/a/feeds/orgunit/2.0/' 'C123A456B/testOrgUnit92')) - self.assertEquals(self.feed.entry[0].org_unit_description, 'test92') - self.RefactoringTool: Refactored ./tests/gdata_tests/apps/multidomain/live_client_test.py assertEquals(self.feed.entry[0].org_unit_name, 'testOrgUnit92') - self.assertEquals(self.feed.entry[0].org_unit_path, 'Test/testOrgUnit92') - self.assertEquals(self.feed.entry[0].parent_org_unit_path, 'Test') - self.assertEquals(self.feed.entry[0].org_unit_block_inheritance, 'false') - self.assertEquals( + self.assertEqual(self.feed.entry[0].org_unit_description, 'test92') + self.assertEqual(self.feed.entry[0].org_unit_name, 'testOrgUnit92') + self.assertEqual(self.feed.entry[0].org_unit_path, 'Test/testOrgUnit92') + self.assertEqual(self.feed.entry[0].parent_org_unit_path, 'Test') + self.assertEqual(self.feed.entry[0].org_unit_block_inheritance, 'false') + self.assertEqual( self.feed.entry[1].find_edit_link(), ('https://apps-apis.google.com/a/feeds/orgunit/2.0/' 'C123A456B/testOrgUnit93')) - self.assertEquals(self.feed.entry[1].org_unit_description, 'test93') - self.assertEquals(self.feed.entry[1].org_unit_name, 'testOrgUnit93') - self.assertEquals(self.feed.entry[1].org_unit_path, 'Test/testOrgUnit93') - self.assertEquals(self.feed.entry[1].parent_org_unit_path, 'Test') - self.assertEquals(self.feed.entry[1].org_unit_block_inheritance, 'false') + self.assertEqual(self.feed.entry[1].org_unit_description, 'test93') + self.assertEqual(self.feed.entry[1].org_unit_name, 'testOrgUnit93') + self.assertEqual(self.feed.entry[1].org_unit_path, 'Test/testOrgUnit93') + self.assertEqual(self.feed.entry[1].parent_org_unit_path, 'Test') + self.assertEqual(self.feed.entry[1].org_unit_block_inheritance, 'false') class OrgUserEntryTest(unittest.TestCase): @@ -97,31 +97,31 @@ gdata.apps.organization.data.OrgUserFeed) def testOrgUserEntryFromString(self): - self.assert_(isinstance(self.entry, + self.assertTrue(isinstance(self.entry, gdata.apps.organization.data.OrgUserEntry)) - self.assertEquals(self.entry.user_email, 'admin@example.com') - self.assertEquals(self.entry.org_unit_path, 'Test') + self.assertEqual(self.entry.user_email, 'admin@example.com') + self.assertEqual(self.entry.org_unit_path, 'Test') def testOrgUserFeedFromString(self): - self.assertEquals(len(self.feed.entry), 2) - self.assert_(isinstance(self.feed, + self.assertEqual(len(self.feed.entry), 2) + self.assertTrue(isinstance(self.feed, gdata.apps.organization.data.OrgUserFeed)) - self.assert_(isinstance(self.feed.entry[0], + self.assertTrue(isinstance(self.feed.entry[0], gdata.apps.organization.data.OrgUserEntry)) - self.assert_(isinstance(self.feed.entry[1], + self.assertTrue(isinstance(self.feed.entry[1], gdata.apps.organization.data.OrgUserEntry)) - self.assertEquals( + self.assertEqual( self.feed.entry[0].find_edit_link(), ('https://apps-apis.google.com/a/feeds/orguser/2.0/' 'C123A456B/user720430%40example.com')) - self.assertEquals(self.feed.entry[0].user_email, 'user720430@example.com') - self.assertEquals(self.feed.entry[0].org_unit_path, 'Test') - self.assertEquals( + self.assertEqual(self.feed.entry[0].user_email, 'user720430@example.com') + self.assertEqual(self.feed.entry[0].org_unit_path, 'Test') + self.assertEqual( self.feed.entry[1].find_edit_link(), ('https://apps-apis.google.com/a/feeds/orguser/2.0/' 'C123A456B/user832648%40example.com')) - self.assertEquals(self.feed.entry[1].user_email, 'user832648@example.com') - self.assertEquals(self.feed.entry[1].org_unit_path, 'Test') + self.assertEqual(self.feed.entry[1].user_email, 'user832648@example.com') + self.assertEqual(self.feed.entry[1].org_unit_path, 'Test') def suite(): --- ./tests/gdata_tests/apps/multidomain/live_client_test.py (original) +++ ./tests/gdata_tests/apps/multidomain/live_client_test.py (refactored) @@ -101,26 +101,26 @@ '51eea05d46317fadd5cad6787a8f562be90b4446', 'true', hash_function='RefactoringTool: Refactored ./tests/gdata_tests/apps/multidomain/data_test.py SHA-1') - self.assert_(isinstance(new_entry, + self.assertTrue(isinstance(new_entry, gdata.apps.multidomain.data.UserEntry)) - self.assertEquals(new_entry.first_name, 'Elizabeth') - self.assertEquals(new_entry.last_name, 'Smith') - self.assertEquals(new_entry.email, email) - self.assertEquals(new_entry.password, + self.assertEqual(new_entry.first_name, 'Elizabeth') + self.assertEqual(new_entry.last_name, 'Smith') + self.assertEqual(new_entry.email, email) + self.assertEqual(new_entry.password, '51eea05d46317fadd5cad6787a8f562be90b4446') - self.assertEquals(new_entry.is_admin, 'true') + self.assertEqual(new_entry.is_admin, 'true') fetched_entry = self.client.RetrieveUser(email=email) - self.assertEquals(fetched_entry.first_name, 'Elizabeth') - self.assertEquals(fetched_entry.last_name, 'Smith') - self.assertEquals(fetched_entry.email, email) - self.assertEquals(fetched_entry.is_admin, 'true') + self.assertEqual(fetched_entry.first_name, 'Elizabeth') + self.assertEqual(fetched_entry.last_name, 'Smith') + self.assertEqual(fetched_entry.email, email) + self.assertEqual(fetched_entry.is_admin, 'true') new_entry.first_name = 'Joe' new_entry.last_name = 'Brown' updated_entry = self.client.UpdateUser( email=email, user_entry=new_entry) - self.assert_(isinstance(updated_entry, + self.assertTrue(isinstance(updated_entry, gdata.apps.multidomain.data.UserEntry)) self.assertEqual(updated_entry.first_name, 'Joe') self.assertEqual(updated_entry.last_name, 'Brown') @@ -128,25 +128,25 @@ new_email = 'renamed_user%s@%s' % (rnd_number, self.client.domain) renamed_entry = self.client.RenameUser( old_email=email, new_email=new_email) - self.assert_(isinstance(renamed_entry, + self.assertTrue(isinstance(renamed_entry, gdata.apps.multidomain.data.UserRenameRequest)) self.assertEqual(renamed_entry.new_email, new_email) new_alias = self.client.CreateAlias(new_email, alias) - self.assert_(isinstance(new_alias, + self.assertTrue(isinstance(new_alias, gdata.apps.multidomain.data.AliasEntry)) - self.assertEquals(new_alias.user_email, new_email) - self.assertEquals(new_alias.alias_email, alias) + self.assertEqual(new_alias.user_email, new_email) + self.assertEqual(new_alias.alias_email, alias) fetched_alias = self.client.RetrieveAlias(alias) - self.assertEquals(fetched_alias.user_email, new_email) - self.assertEquals(fetched_alias.alias_email, alias) + self.assertEqual(fetched_alias.user_email, new_email) + self.assertEqual(fetched_alias.alias_email, alias) fetched_aliases = self.client.RetrieveAllUserAliases(new_email) - self.assertEquals(fetched_aliases.entry[0].user_email, new_email) - self.assertEquals(fetched_aliases.entry[0].alias_email, email) - self.assertEquals(fetched_aliases.entry[1].user_email, new_email) - self.assertEquals(fetched_aliases.entry[1].alias_email, alias) + self.assertEqual(fetched_aliases.entry[0].user_email, new_email) + self.assertEqual(fetched_aliases.entry[0].alias_email, email) + self.assertEqual(fetched_aliases.entry[1].user_email, new_email) + self.assertEqual(fetched_aliases.entry[1].alias_email, alias) self.client.DeleteAlias(alias) self.client.DeleteUser(new_email) --- ./tests/gdata_tests/apps/multidomain/data_test.py (original) +++ ./tests/gdata_tests/apps/multidomain/data_test.py (refactored) @@ -36,45 +36,45 @@ gdata.apps.multidomain.data.UserFeed) def testUserEntryFromString(self): - self.assert_(isinstance(self.entry, + self.assertTrue(isinstance(self.entry, gdata.apps.multidomain.data.UserEntry)) - self.assertEquals(self.entry.first_name, 'Liz') - self.assertEquals(self.entry.last_name, 'Smith') - self.assertEquals(self.entry.email, 'liz@example.com') - self.assertEquals(self.entry.password, + self.assertEqual(self.entry.first_name, 'Liz') + self.assertEqual(self.entry.last_name, 'Smith') + self.assertEqual(self.entry.email, 'liz@example.com') + self.assertEqual(self.entry.password, '51eea05d46317fadd5cad6787a8f562be90b4446') - self.assertEquals(self.entry.is_admin, 'true') + self.assertEqual(self.entry.is_admin, 'true') def testUserFeedFromString(self): - self.assertEquals(len(self.feed.entry), 2) - self.assert_(isinstance(self.feed, + self.assertEqual(len(self.feed.entry), 2) + self.assertTrue(isinstance(self.feed, gdata.apps.multidomain.data.UserFeed)) - self.assert_(isinstance(self.feed.entry[0], + self.assertTrue(isinstance(self.feed.entry[0], gdata.apps.multidomain.data.UserEntry)) - self.assert_(isinstance(self.feed.entry[1], + self.assertTrue(isinstance(self.feed.entry[1], gdata.apps.multidomain.data.UserEntry)) - self.assertEquals( + self.assertEqual( self.feed.entry[0].find_edit_link(), ('https://apps-apis.google.com/a/feeds/user/2.0/example.com/' 'admin%40example.com')) - self.assertEquals(self.feed.entry[0].first_name, 'Joe') - self.assertEquals(self.feed.entry[0].last_name, 'Brown') - self.assertEquals(self.feed.entry[0].email, 'admin@example.com') - self.assertEquals(self.feed.entry[0].is_admin, 'true') - self.assertEquals(self.feed.entry[0].suspended, 'false') - self.assertEquals(self.feed.entry[0].change_password_at_next_login, 'false') - self.assertEquals(self.feed.entry[0].ip_whitelisted, 'false') - self.assertEquals( + self.assertEqual(self.feed.entry[0].first_name, 'Joe') + self.assertEqual(self.feed.entry[0].last_name, 'Brown') + self.assertEqual(self.feed.entry[0].email, 'admin@example.com') + self.assertEqual(self.feed.entry[0].is_admin, 'true') + self.assertEqual(self.feed.entry[0].suspended, 'false') + self.assertEqual(self.feed.entry[0].change_password_at_next_login, 'false') + self.assertEqual(self.feed.entry[0].ip_whitelisted, 'false') + self.assertEqual( self.feed.entry[1].find_edit_link(), ('https://apps-apis.google.com/a/feeds/user/2.0/example.com/' 'liz%40example.com')) - self.assertEquals(self.feed.entry[1].first_name, 'Elizabeth') - self.assertEquals(self.feed.entry[1].last_name, 'Smith') - self.assertEquals(self.feed.entry[1].email, 'liz@example.com') - self.assertEquals(self.feed.entry[1].is_admin, 'true') - self.assertEquals(self.feed.entry[1].suspended, 'false') - self.assertEquals(self.feed.entry[1].change_password_at_next_login, 'false') - self.assertEquals(self.feed.entry[1].ip_whitelisted, 'false') + self.assertEqual(self.feed.entry[1].first_name, 'Elizabeth') + self.assertEqual(self.feed.entry[1].last_name, 'Smith') + self.assertEqual(self.feed.entry[1].email, 'liz@example.com') + self.assertEqual(self.feed.entry[1].is_admin, 'true') + self.assertEqual(self.feed.entry[1].suspended, 'false') + self.assertEqual(self.feed.entry[1].change_password_at_next_login, 'false') + self.assertEqual(self.feed.entry[1].ip_whitelisted, 'false') class UserRenameRequestTest(unittest.TestCase): @@ -84,9 +84,9 @@ gdata.apps.multidomain.data.UserRenameRequest) def testUserRenameRequestFromString(self): - self.assert_(isinstance(self.entry, + self.assertTrue(isinstance(self.entry, gdata.apps.multidomain.data.UserRenameRequest)) - self.assertEquals(self.entry.new_email, 'liz@newexample4liz.com') + self.assertEqual(self.entry.new_email, 'liz@newexample4liz.com') class AliasEntryTest(unittest.TestCase): @@ -98,32 +98,32 @@ gdata.apps.multidomain.data.AliasFeed) def testAliasEntryFromString(self): - self.assert_(isinstance(self.entry, + self.assertTrue(isinstance(self.entry, gdata.apps.multidomain.data.AliasEntry)) - self.assertEquals(self.entry.user_email, 'liz@example.com') - self.assertEquals(self.entry.alias_email, 'helpdesk@gethelp_example.com') + self.assertEqual(self.entry.user_email, 'liz@example.com') + self.assertEqual(self.entry.alias_email, 'helpdesk@gethelp_example.com') RefactoringTool: Refactored ./tests/gdata_tests/apps/migration/service_test.py RefactoringTool: Refactored ./tests/gdata_tests/apps/live_client_test.py def testAliasFeedFromString(self): - self.assertEquals(len(self.feed.entry), 2) - self.assert_(isinstance(self.feed, + self.assertEqual(len(self.feed.entry), 2) + self.assertTrue(isinstance(self.feed, gdata.apps.multidomain.data.AliasFeed)) - self.assert_(isinstance(self.feed.entry[0], + self.assertTrue(isinstance(self.feed.entry[0], gdata.apps.multidomain.data.AliasEntry)) - self.assert_(isinstance(self.feed.entry[1], + self.assertTrue(isinstance(self.feed.entry[1], gdata.apps.multidomain.data.AliasEntry)) - self.assertEquals( + self.assertEqual( self.feed.entry[0].find_edit_link(), ('https://apps-apis.google.com/a/feeds/alias/2.0/gethelp_example.com/' 'helpdesk%40gethelp_example.com')) - self.assertEquals(self.feed.entry[0].user_email, 'liz@example.com') - self.assertEquals(self.feed.entry[0].alias_email, + self.assertEqual(self.feed.entry[0].user_email, 'liz@example.com') + self.assertEqual(self.feed.entry[0].alias_email, 'helpdesk@gethelp_example.com') - self.assertEquals( + self.assertEqual( self.feed.entry[1].find_edit_link(), ('https://apps-apis.google.com/a/feeds/alias/2.0/gethelp_example.com/' 'support%40gethelp_example.com')) - self.assertEquals(self.feed.entry[1].user_email, 'joe@example.com') - self.assertEquals(self.feed.entry[1].alias_email, + self.assertEqual(self.feed.entry[1].user_email, 'joe@example.com') + self.assertEqual(self.feed.entry[1].alias_email, 'support@gethelp_example.com') --- ./tests/gdata_tests/apps/migration/service_test.py (original) +++ ./tests/gdata_tests/apps/migration/service_test.py (refactored) @@ -52,7 +52,7 @@ mail_labels=['Test']) def testImportMultipleMails(self): - for i in xrange(1, 10): + for i in range(1, 10): self.ms.AddMailEntry(mail_message=MESSAGE % ('Test thread %d' % i, 'Test thread'), mail_item_properties=['IS_UNREAD'], @@ -64,8 +64,8 @@ if __name__ == '__main__': print("Google Apps Email Migration Service Tests\n\n" "NOTE: Please run these tests only with a test user account.\n") - domain = raw_input('Google Apps domain: ') - admin_email = '%s@%s' % (raw_input('Administrator username: '), domain) + domain = input('Google Apps domain: ') + admin_email = '%s@%s' % (input('Administrator username: '), domain) admin_password = getpass.getpass('Administrator password: ') - username = raw_input('Test username: ') + username = input('Test username: ') unittest.main() --- ./tests/gdata_tests/apps/live_client_test.py (original) +++ ./tests/gdata_tests/apps/live_client_test.py (refactored) @@ -90,38 +90,38 @@ user_name=username, given_name='Elizabeth', family_name='Smith', password='password', admin='true') - self.assert_(isinstance(new_entry, + self.assertTrue(isinstance(new_entry, gdata.apps.data.UserEntry)) - self.assertEquals(new_entry.name.given_name, 'Elizabeth') - self.assertEquals(new_entry.name.family_name, 'Smith') - self.assertEquals(new_entry.login.user_name, username) - self.assertEquals(new_entry.login.admin, 'true') + self.assertEqual(new_entry.name.given_name, 'Elizabeth') + self.assertEqual(new_entry.name.family_name, 'Smith') + self.assertEqual(new_entry.login.user_name, username) + self.assertEqual(new_entry.login.admin, 'true') fetched_entry = self.client.RetrieveUser(user_name=username) - self.assertEquals(fetched_entry.name.given_name, 'Elizabeth') - self.assertEquals(fetched_entry.name.family_name, 'Smith') - self.assertEquals(fetched_entry.login.user_name, username) - self.assertEquals(fetched_entry.login.admin, 'true') + self.assertEqual(fetched_entry.name.given_name, 'Elizabeth') + self.assertEqual(fetched_entry.name.family_name, 'Smith') + self.assertEqual(fetched_entry.login.user_name, username) + self.assertEqual(fetchedRefactoringTool: Refactored ./tests/gdata_tests/apps/groups/service_test.py _entry.login.admin, 'true') new_entry.name.given_name = 'Joe' new_entry.name.family_name = 'Brown' updated_entry = self.client.UpdateUser( user_name=username, user_entry=new_entry) - self.assert_(isinstance(updated_entry, + self.assertTrue(isinstance(updated_entry, gdata.apps.data.UserEntry)) self.assertEqual(updated_entry.name.given_name, 'Joe') self.assertEqual(updated_entry.name.family_name, 'Brown') new_nickname = self.client.CreateNickname(user_name=username, nickname=nickname) - self.assert_(isinstance(new_nickname, + self.assertTrue(isinstance(new_nickname, gdata.apps.data.NicknameEntry)) - self.assertEquals(new_nickname.login.user_name, username) - self.assertEquals(new_nickname.nickname.name, nickname) + self.assertEqual(new_nickname.login.user_name, username) + self.assertEqual(new_nickname.nickname.name, nickname) fetched_alias = self.client.RetrieveNickname(nickname) - self.assertEquals(fetched_alias.login.user_name, username) - self.assertEquals(fetched_alias.nickname.name, nickname) + self.assertEqual(fetched_alias.login.user_name, username) + self.assertEqual(fetched_alias.nickname.name, nickname) self.client.DeleteNickname(nickname) self.client.DeleteUser(username) --- ./tests/gdata_tests/apps/groups/service_test.py (original) +++ ./tests/gdata_tests/apps/groups/service_test.py (refactored) @@ -67,8 +67,8 @@ self.user_yuji = self.apps_client.CreateUser( user_name=user_name, family_name=family_name, given_name=given_name, password=password, suspended=suspended) - print 'User ' + user_name + ' created' - except Exception, e: + print('User ' + user_name + ' created') + except Exception as e: self.fail('Unexpected exception occurred: %s' % e) self.created_users.append(self.user_yuji) @@ -83,26 +83,26 @@ self.user_taro = self.apps_client.CreateUser( user_name=user_name, family_name=family_name, given_name=given_name, password=password, suspended=suspended) - print 'User ' + user_name + ' created' - except Exception, e: + print('User ' + user_name + ' created') + except Exception as e: self.fail('Unexpected exception occurred: %s' % e) self.created_users.append(self.user_taro) def tearDown(self): - print '\n' + print('\n') for user in self.created_users: try: self.apps_client.DeleteUser(user.login.user_name) - print 'User ' + user.login.user_name + ' deleted' - except Exception, e: - print e + print('User ' + user.login.user_name + ' deleted') + except Exception as e: + print(e) for group in self.created_groups: try: self.groups_client.DeleteGroup(group) - print 'Group ' + group + ' deleted' - except Exception, e: - print e + print('Group ' + group + ' deleted') + except Exception as e: + print(e) def test001GroupsMethods(self): # tests CreateGroup method @@ -113,11 +113,11 @@ 'Testing', gdata.apps.groups.service.PERMISSION_OWNER) created_group02 = self.groups_client.CreateGroup(group02_id, 'US Sales 2', 'Testing', gdata.apps.groups.service.PERMISSION_OWNER) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assertEquals(created_group01['groupId'], group01_id) - self.assertEquals(created_group02['groupId'], group02_id) + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertEqual(created_group01['groupId'], group01_id) + self.assertEqual(created_group02['groupId'], group02_id) self.created_groups.append(group01_id) self.created_groups.append(group02_id) @@ -125,26 +125,26 @@ try: updated_group = self.groups_client.UpdateGroup(group01_id, 'Updated!', 'Testing', gdata.apps.groups.service.PERMISSION_OWNER) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assertEquals(updated_group['groupName'], 'Updated!') + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertEqual(updated_group['groupName'], 'Updated!') # tests RetrieveGroup method try: retrieved_group = self.groups_client.RetrieveGroup(group01_id) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assertEquals(retrieved_group['groupId'], group01_id + '@' + domain) + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertEqual(retrieved_group['groupId'], group01_id + '@' + domain) # tests RetrieveAllGroups method try: retrieved_groups = self.groups_client.RetrieveAllGroups() - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assertEquals(len(retrieved_groups), + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertEqual(len(retrieved_groups), len(self.apps_client.RetrieveAllEmailLists().entry)) # tests AddMemberToGroup @@ -155,10 +155,10 @@ self.user_taro.login.user_name, group02_id) self.groups_client.AddMemberToGroup( group01_id, group02_id) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assertEquals(added_member['memberId'], + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertEqual(added_member['memberId'], self.user_yuji.login.user_name) # tests RetrieveGroups method @@ -167,10 +167,10 @@ self.user_yuji.login.user_name, True) retrieved_groups = self.groups_client.RetrieveGroups( self.user_yuji.login.user_name, False) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assertEquals(len(retrieved_direct_groups), 1) + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertEqual(len(retrieved_direct_groups), 1) # TODO: Enable this test after a directOnly bug is fixed #self.assertEquals(len(retrieved_groups), 2) @@ -178,85 +178,85 @@ try: result = self.groups_client.IsMember( self.user_yuji.login.user_name, group01_id) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assertEquals(result, True) + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertEqual(result, True) # tests RetrieveMember method try: retrieved_member = self.groups_client.RetrieveMember( self.user_yuji.login.user_name, group01_id) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assertEquals(retrieved_member['memberId'], + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertEqual(retrieved_member['memberId'], self.user_yuji.login.user_name + '@' + domain) # tests RetrieveAllMembers method try: retrieved_members = self.groups_client.RetrieveAllMembers(group01_id) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assertEquals(len(retrieved_members), 1) + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertEqual(len(retrieved_members), 1) # tests RemoveMemberFromGroup method try: self.groups_client.RemoveMemberFromGroup(self.user_yuji.login.user_name, group01_id) retrieved_members = self.groups_client.RetrieveAllMembers(group01_id) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assertEquals(len(retrieved_members), 0) + except Exception as e: + self.fail('Unexpected exception occurrRefactoringTool: Refactored ./tests/gdata_tests/apps/groups/live_client_test.py ed: %s' % e) + + self.assertEqual(len(retrieved_members), 0) # tests AddOwnerToGroup try: added_owner = self.groups_client.AddOwnerToGroup( self.user_yuji.login.user_name, group01_id) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assertEquals(added_owner['email'], + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertEqual(added_owner['email'], self.user_yuji.login.user_name) # tests IsOwner method try: result = self.groups_client.IsOwner( self.user_yuji.login.user_name, group01_id) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assertEquals(result, True) + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertEqual(result, True) # tests RetrieveOwner method try: retrieved_owner = self.groups_client.RetrieveOwner( self.user_yuji.login.user_name, group01_id) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assertEquals(retrieved_owner['email'], + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertEqual(retrieved_owner['email'], self.user_yuji.login.user_name + '@' + domain) # tests RetrieveAllOwners method try: retrieved_owners = self.groups_client.RetrieveAllOwners(group01_id) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assertEquals(len(retrieved_owners), 1) + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertEqual(len(retrieved_owners), 1) # tests RemoveOwnerFromGroup method try: self.groups_client.RemoveOwnerFromGroup(self.user_yuji.login.user_name, group01_id) retrieved_owners = self.groups_client.RetrieveAllOwners(group01_id) - except Exception, e: - self.fail('Unexpected exception occurred: %s' % e) - - self.assertEquals(len(retrieved_owners), 0) + except Exception as e: + self.fail('Unexpected exception occurred: %s' % e) + + self.assertEqual(len(retrieved_owners), 0) if __name__ == '__main__': @@ -264,7 +264,7 @@ NOTE: Please run these tests only with a test user account. """) - domain = raw_input('Google Apps domain: ') - admin_email = '%s@%s' % (raw_input('Administrator username: '), domain) + domain = input('Google Apps domain: ') + admin_email = '%s@%s' % (input('Administrator username: '), domain) admin_password = getpass.getpass('Administrator password: ') unittest.main() --- ./tests/gdata_tests/apps/groups/live_client_test.py (original) +++ ./tests/gdata_tests/apps/groups/live_client_test.py (refactored) @@ -102,37 +102,37 @@ group_id=group_id, group_name=group_name, description='Test Group', email_permission='Domain') - self.assert_(isinstance(new_group, + self.assertTrue(isinstance(new_group, gdata.apps.groups.data.GroupEntry)) - self.assertEquals(new_group.group_id, group_id) - self.assertEquals(new_group.group_name, group_name) - self.assertEquals(new_group.description, 'Test Group') - self.assertEquals(new_group.email_permission, 'Domain') + self.assertEqual(new_group.group_id, group_id) + self.assertEqual(new_group.group_name, group_name) + self.assertEqual(new_group.description, 'Test Group') + self.assertEqual(new_group.email_permission, 'Domain') fetched_entry = self.client.RetrieveGroup(group_id=group_id) - self.assert_(isinstance(fetched_entry, + self.assertTrue(isinstance(fetched_entry, gdata.apps.groups.data.GroupEntry)) - self.assertEquals(new_group.group_id, group_id) - self.assertEquals(new_group.group_name, group_name) - self.assertEquals(new_group.description, 'Test Group') - RefactoringTool: Refactored ./tests/gdata_tests/apps/groups/data_test.py self.assertEquals(new_group.email_permission, 'Domain') + self.assertEqual(new_group.group_id, group_id) + self.assertEqual(new_group.group_name, group_name) + self.assertEqual(new_group.description, 'Test Group') + self.assertEqual(new_group.email_permission, 'Domain') new_group.group_name = 'updated name' updated_group = self.client.UpdateGroup( group_id=group_id, group_entry=new_group) - self.assert_(isinstance(updated_group, + self.assertTrue(isinstance(updated_group, gdata.apps.groups.data.GroupEntry)) self.assertEqual(updated_group.group_name, 'updated name') new_member = self.client.AddMemberToGroup(group_id=group_id, member_id=member_id) - self.assert_(isinstance(new_member, + self.assertTrue(isinstance(new_member, gdata.apps.groups.data.GroupMemberEntry)) - self.assertEquals(new_member.member_id, member_id) + self.assertEqual(new_member.member_id, member_id) fetched_member = self.client.RetrieveGroupMember(group_id=group_id, member_id=member_id) - self.assertEquals(fetched_member.member_id, member_id) + self.assertEqual(fetched_member.member_id, member_id) self.client.RemoveMemberFromGroup(group_id=group_id, member_id=member_id) --- ./tests/gdata_tests/apps/groups/data_test.py (original) +++ ./tests/gdata_tests/apps/groups/data_test.py (refactored) @@ -36,37 +36,37 @@ gdata.apps.groups.data.GroupFeed, 2) def testGroupEntryFromString(self): - self.assert_(isinstance(self.entry, + self.assertTrue(isinstance(self.entry, gdata.apps.groups.data.GroupEntry)) - self.assertEquals(self.entry.group_id, 'trial@srkapps.com') - self.assertEquals(self.entry.group_name, 'Trial') - self.assertEquals(self.entry.email_permission, 'Domain') - self.assertEquals(self.entry.description, 'For try') + self.assertEqual(self.entry.group_id, 'trial@srkapps.com') + self.assertEqual(self.entry.group_name, 'Trial') + self.assertEqual(self.entry.email_permission, 'Domain') + self.assertEqual(self.entry.description, 'For try') def testGroupFeedFromString(self): - self.assertEquals(len(self.feed.entry), 2) - self.assert_(isinstance(self.feed, + self.assertEqual(len(self.feed.entry), 2) + self.assertTrue(isinstance(self.feed, gdata.apps.groups.data.GroupFeed)) - self.assert_(isinstance(self.feed.entry[0], + self.assertTrue(isinstance(self.feed.entry[0], gdata.apps.groups.data.GroupEntry)) - self.assert_(isinstance(self.feed.entry[1], + self.assertTrue(isinstance(self.feed.entry[1], gdata.apps.groups.data.GroupEntry)) - self.assertEquals( + self.assertEqual( self.feed.entry[0].find_edit_link(), ('http://apps-apis.google.com/a/feeds/group/2.0/srkapps.com/' 'firstgroup%40srkapps.com')) - self.assertEquals(self.feed.entry[0].group_id, 'firstgroup@srkapps.com') - self.assertEquals(self.feed.entry[0].group_name, 'FirstGroup') - self.assertEquals(self.feed.entry[0].email_permission, 'Domain') - self.assertEquals(self.feed.entry[0].description, 'First group') - self.assertEquals( + self.assertEqual(self.feed.entry[0].group_id, 'firstgroup@srkapps.com') + self.assertEqual(self.feed.entry[0].group_name, 'FirstGroup') + self.assertEqual(self.feed.entry[0].email_permission, 'Domain') + self.assertEqual(self.feed.entry[0].description, 'First group') + self.assertEqual( self.feed.entry[1].find_edit_link(), ('http://apps-apis.google.com/a/feeds/group/2.0/srkapps.com/' 'trial%40srkapps.com')) - self.assertEquals(self.feed.entry[1].group_id, 'trial@srkapps.com') - self.assertEquals(self.feed.entry[1].group_name, 'Trial') - self.assertEquals(self.feed.entry[1].email_permission, 'Domain') - self.assertEquals(self.feed.entry[1].description, 'For try') + self.assertEqual(self.feed.entry[1].group_id, 'trial@srkapps.com') + self.assertEqual(self.feed.entry[1].group_name, 'Trial') + self.assertEqual(self.feed.entry[1].emaiRefactoringTool: Refactored ./tests/gdata_tests/apps/emailsettings/service_test.py l_permission, 'Domain') + self.assertEqual(self.feed.entry[1].description, 'For try') class GroupMemberEntryTest(unittest.TestCase): @@ -78,35 +78,35 @@ gdata.apps.groups.data.GroupMemberFeed) def testGroupMemberEntryFromString(self): - self.assert_(isinstance(self.entry, + self.assertTrue(isinstance(self.entry, gdata.apps.groups.data.GroupMemberEntry)) - self.assertEquals(self.entry.member_id, 'abcd12310@srkapps.com') - self.assertEquals(self.entry.member_type, 'User') - self.assertEquals(self.entry.direct_member, 'true') + self.assertEqual(self.entry.member_id, 'abcd12310@srkapps.com') + self.assertEqual(self.entry.member_type, 'User') + self.assertEqual(self.entry.direct_member, 'true') def testGroupMemberFeedFromString(self): - self.assertEquals(len(self.feed.entry), 2) - self.assert_(isinstance(self.feed, + self.assertEqual(len(self.feed.entry), 2) + self.assertTrue(isinstance(self.feed, gdata.apps.groups.data.GroupMemberFeed)) - self.assert_(isinstance(self.feed.entry[0], + self.assertTrue(isinstance(self.feed.entry[0], gdata.apps.groups.data.GroupMemberEntry)) - self.assert_(isinstance(self.feed.entry[1], + self.assertTrue(isinstance(self.feed.entry[1], gdata.apps.groups.data.GroupMemberEntry)) - self.assertEquals( + self.assertEqual( self.feed.entry[0].find_edit_link(), ('http://apps-apis.google.com/a/feeds/group/2.0/srkapps.com/trial/' 'member/abcd12310%40srkapps.com')) - self.assertEquals(self.feed.entry[0].member_id, 'abcd12310@srkapps.com') - self.assertEquals(self.feed.entry[0].member_type, 'User') - self.assertEquals(self.feed.entry[0].direct_member, 'true') - self.assertEquals( + self.assertEqual(self.feed.entry[0].member_id, 'abcd12310@srkapps.com') + self.assertEqual(self.feed.entry[0].member_type, 'User') + self.assertEqual(self.feed.entry[0].direct_member, 'true') + self.assertEqual( self.feed.entry[1].find_edit_link(), ('http://apps-apis.google.com/a/feeds/group/2.0/srkapps.com/trial/' 'member/neha.technocrat%40srkapps.com')) - self.assertEquals(self.feed.entry[1].member_id, + self.assertEqual(self.feed.entry[1].member_id, 'neha.technocrat@srkapps.com') - self.assertEquals(self.feed.entry[1].member_type, 'User') - self.assertEquals(self.feed.entry[1].direct_member, 'true') + self.assertEqual(self.feed.entry[1].member_type, 'User') + self.assertEqual(self.feed.entry[1].direct_member, 'true') def suite(): --- ./tests/gdata_tests/apps/emailsettings/service_test.py (original) +++ ./tests/gdata_tests/apps/emailsettings/service_test.py (refactored) @@ -41,7 +41,7 @@ def testCreateLabel(self): result = self.es.CreateLabel(username, label='New label!!!') - self.assertEquals(result['label'], 'New label!!!') + self.assertEqual(result['label'], 'New label!!!') def testCreateFilter(self): result = self.es.CreateFilter(username, @@ -54,9 +54,9 @@ label='label_foo', should_mark_as_read=True, should_archive=True) - self.assertEquals(result['from'], 'from_foo') - self.assertEquals(result['to'], 'to_foo') - self.assertEquals(result['subject'], 'subject_foo') + self.assertEqual(result['from'], 'from_foo') + self.assertEqual(result['to'], 'to_foo') + self.assertEqual(result['subject'], 'subject_foo') def testCreateSendAsAlias(self): result = self.es.CreateSendAsAlias(username, @@ -64,29 +64,29 @@ address='user2@sizzles.org', reply_to='user3@sizzles.org', make_default=True) - self.assertEquals(result['name'], 'Send-as Alias') + self.assertEqual(result['name'], 'Send-as Alias') def testUpdateWebClipSettings(self): result = self.es.UpdateWebClipSettings(username, enable=True) - self.assertEquals(result['enRefactoringTool: Refactored ./tests/gdata_tests/apps/emailsettings/live_client_test.py able'], 'true') + self.assertEqual(result['enable'], 'true') def testUpdateForwarding(self): result = self.es.UpdateForwarding(username, enable=True, forward_to='user4@sizzles.org', action=gdata.apps.emailsettings.service.KEEP) - self.assertEquals(result['enable'], 'true') + self.assertEqual(result['enable'], 'true') def testUpdatePop(self): result = self.es.UpdatePop(username, enable=True, enable_for=gdata.apps.emailsettings.service.ALL_MAIL, action=gdata.apps.emailsettings.service.ARCHIVE) - self.assertEquals(result['enable'], 'true') + self.assertEqual(result['enable'], 'true') def testUpdateImap(self): result = self.es.UpdateImap(username, enable=True) - self.assertEquals(result['enable'], 'true') + self.assertEqual(result['enable'], 'true') def testUpdateVacation(self): result = self.es.UpdateVacation(username, @@ -94,15 +94,15 @@ subject='Hawaii', message='Wish you were here!', contacts_only=True) - self.assertEquals(result['subject'], 'Hawaii') + self.assertEqual(result['subject'], 'Hawaii') def testUpdateSignature(self): result = self.es.UpdateSignature(username, signature='Signature') - self.assertEquals(result['signature'], 'Signature') + self.assertEqual(result['signature'], 'Signature') def testUpdateLanguage(self): result = self.es.UpdateLanguage(username, language='fr') - self.assertEquals(result['language'], 'fr') + self.assertEqual(result['language'], 'fr') def testUpdateGeneral(self): result = self.es.UpdateGeneral(username, @@ -110,8 +110,8 @@ shortcuts=True, arrows=True, snippets=True, - unicode=True) - self.assertEquals(result['pageSize'], '100') + str=True) + self.assertEqual(result['pageSize'], '100') if __name__ == '__main__': @@ -119,8 +119,8 @@ NOTE: Please run these tests only with a test user account. """) - domain = raw_input('Google Apps domain: ') - admin_email = '%s@%s' % (raw_input('Administrator username: '), domain) + domain = input('Google Apps domain: ') + admin_email = '%s@%s' % (input('Administrator username: '), domain) admin_password = getpass.getpass('Administrator password: ') - username = raw_input('Test username: ') + username = input('Test username: ') unittest.main() --- ./tests/gdata_tests/apps/emailsettings/live_client_test.py (original) +++ ./tests/gdata_tests/apps/emailsettings/live_client_test.py (refactored) @@ -76,7 +76,7 @@ username=conf.options.get_value('targetusername'), name='status updates') - self.assert_(isinstance(new_label, + self.assertTrue(isinstance(new_label, gdata.apps.emailsettings.data.EmailSettingsLabel)) self.assertEqual(new_label.name, 'status updates') @@ -96,7 +96,7 @@ from_address='alice@gmail.com', has_the_word='project proposal', mark_as_read=True) - self.assert_(isinstance(new_filter, + self.assertTrue(isinstance(new_filter, gdata.apps.emailsettings.data.EmailSettingsFilter)) self.assertEqual(new_filter.from_address, 'alice@gmail.com') self.assertEqual(new_filter.has_the_word, 'project proposal') @@ -107,7 +107,7 @@ to_address='announcements@example.com', label="announcements") - self.assert_(isinstance(new_filter, + self.assertTrue(isinstance(new_filter, gdata.apps.emailsettings.data.EmailSettingsFilter)) self.assertEqual(new_filter.to_address, 'announcements@example.com') self.assertEqual(new_filter.label, 'announcements') @@ -119,7 +119,7 @@ has_attachments=True, archive=True) - self.assert_(isinstance(new_filter, + self.assertTrue(isinstance(new_filter, gdata.apps.emailsettings.data.EmailSettingsFilter)) self.assertEqual(new_filter.subject, 'urgent') self.assertEqual(new_filter.does_not_have_the_word, 'spam') @@ -139,7 +139,7 @@ reply_to='abc@gmail.com', make_default=True) - self.assert_(isinstance(new_sendas, + self.assertTrue(isinstance(new_sendas, gdata.apps.emailsettings.data.EmailSettingsSendAsAlias)) self.assertEqual(new_sendas.name, 'Sales') self.assertEqual(new_sendas.address, @@ -158,7 +158,7 @@ username=conf.options.get_value('targetusername'), enable=True) - self.assert_(isinstance(new_webclip, + self.assertTrue(isinstance(new_webclip, gdata.apps.emailsettings.data.EmailSettingsWebClip)) self.assertEqual(new_webclip.enable, 'True') @@ -166,7 +166,7 @@ username=conf.options.get_value('targetusername'), enable=False) - self.assert_(isinstance(new_webclip, + self.assertTrue(isinstance(new_webclip, gdata.apps.emailsettings.data.EmailSettingsWebClip)) self.assertEqual(new_webclip.enable, 'False') @@ -183,7 +183,7 @@ forward_to=conf.options.get_value('appsusername'), action='KEEP') - self.assert_(isinstance(new_forwarding, + self.assertTrue(isinstance(new_forwarding, gdata.apps.emailsettings.data.EmailSettingsForwarding)) self.assertEqual(new_forwarding.enable, 'True') self.assertEqual(new_forwarding.forward_to, @@ -194,7 +194,7 @@ username=conf.options.get_value('targetusername'), enable=False) - self.assert_(isinstance(new_forwarding, + self.assertTrue(isinstance(new_forwarding, gdata.apps.emailsettings.data.EmailSettingsForwarding)) self.assertEqual(new_forwarding.enable, 'False') @@ -209,7 +209,7 @@ username=conf.options.get_value('targetusername'), enable=True, enable_for='MAIL_FROM_NOW_ON', action='KEEP') - self.assert_(isinstance(new_pop, + self.assertTrue(isinstance(new_pop, gdata.apps.emailsettings.data.EmailSettingsPop)) self.assertEqual(new_pop.enable, 'True') self.assertEqual(new_pop.enable_for, 'MAIL_FROM_NOW_ON') @@ -219,7 +219,7 @@ username=conf.options.get_value('targetusername'), enable=False) - self.assert_(isinstance(new_pop, + self.assertTrue(isinstance(new_pop, gdata.apps.emailsettings.data.EmailSettingsPop)) self.assertEqual(new_pop.enable, 'False') @@ -234,7 +234,7 @@ username=conf.options.get_value('targetusername'), enable=True) - self.assert_(isinstance(new_imap, + self.assertTrue(isinstance(new_imap, gdata.apps.emailsettings.data.EmailSettingsImap)) self.assertEqual(new_imap.enable, 'True') @@ -242,7 +242,7 @@ username=conf.options.get_value('targetusername'), enable=False) - self.assert_(isinstance(new_imap, + self.assertTrue(isinstance(new_imap, gdata.apps.emailsettings.data.EmailSettingsImap)) self.assertEqual(new_imap.enable, 'False') @@ -260,7 +260,7 @@ start_date='2011-12-05', end_date='2011-12-06', contacts_only=True, domain_only=False) - self.assert_(isinstance(new_vacation, + self.assertTrue(isinstance(new_vacation, gdata.apps.emailsettings.data.EmailSettingsVacationResponder)) self.assertEqual(new_vacation.enable, 'True') self.assertEqual(new_vacation.subject, 'Out of office') @@ -274,7 +274,7 @@ username=conf.options.get_value('targetusername'), enable=False) - self.assert_(isinstance(new_vacation, + self.assertTrue(isinstance(new_vacation, gdata.apps.emailsettings.data.EmailSettingsVacationResponder)) self.assertEqual(new_vacation.enable, 'False') @@ -289,7 +289,7 @@ username=conf.options.get_value('targetusername'), signature='Regards, Joe') - self.assert_(isinstance(new_signature, + self.assertTrue(isinstance(new_signatureRefactoringTool: Refactored ./tests/gdata_tests/apps/emailsettings/data_test.py , gdata.apps.emailsettings.data.EmailSettingsSignature)) self.assertEqual(new_signature.signature_value, 'Regards, Joe') @@ -297,7 +297,7 @@ username=conf.options.get_value('targetusername'), signature='') - self.assert_(isinstance(new_signature, + self.assertTrue(isinstance(new_signature, gdata.apps.emailsettings.data.EmailSettingsSignature)) self.assertEqual(new_signature.signature_value, '') @@ -312,7 +312,7 @@ username=conf.options.get_value('targetusername'), language='es') - self.assert_(isinstance(new_language, + self.assertTrue(isinstance(new_language, gdata.apps.emailsettings.data.EmailSettingsLanguage)) self.assertEqual(new_language.language_tag, 'es') @@ -327,7 +327,7 @@ username=conf.options.get_value('targetusername'), page_size=25, arrows=True) - self.assert_(isinstance(new_general, + self.assertTrue(isinstance(new_general, gdata.apps.emailsettings.data.EmailSettingsGeneral)) self.assertEqual(new_general.page_size, '25') self.assertEqual(new_general.arrows, 'True') @@ -336,7 +336,7 @@ username=conf.options.get_value('targetusername'), shortcuts=False, snippets=True, use_unicode=False) - self.assert_(isinstance(new_general, + self.assertTrue(isinstance(new_general, gdata.apps.emailsettings.data.EmailSettingsGeneral)) self.assertEqual(new_general.shortcuts, 'False') self.assertEqual(new_general.snippets, 'True') --- ./tests/gdata_tests/apps/emailsettings/data_test.py (original) +++ ./tests/gdata_tests/apps/emailsettings/data_test.py (refactored) @@ -30,7 +30,7 @@ def testName(self): self.entry.name = 'test label' - self.assertEquals(self.entry.name, 'test label') + self.assertEqual(self.entry.name, 'test label') class EmailSettingsFilterTest(unittest.TestCase): @@ -40,43 +40,43 @@ def testFrom(self): self.entry.from_address = 'abc@example.com' - self.assertEquals(self.entry.from_address, 'abc@example.com') + self.assertEqual(self.entry.from_address, 'abc@example.com') def testTo(self): self.entry.to_address = 'to@example.com' - self.assertEquals(self.entry.to_address, 'to@example.com') + self.assertEqual(self.entry.to_address, 'to@example.com') def testFrom(self): self.entry.from_address = 'abc@example.com' - self.assertEquals(self.entry.from_address, 'abc@example.com') + self.assertEqual(self.entry.from_address, 'abc@example.com') def testSubject(self): self.entry.subject = 'Read me' - self.assertEquals(self.entry.subject, 'Read me') + self.assertEqual(self.entry.subject, 'Read me') def testHasTheWord(self): self.entry.has_the_word = 'important' - self.assertEquals(self.entry.has_the_word, 'important') + self.assertEqual(self.entry.has_the_word, 'important') def testDoesNotHaveTheWord(self): self.entry.does_not_have_the_word = 'spam' - self.assertEquals(self.entry.does_not_have_the_word, 'spam') + self.assertEqual(self.entry.does_not_have_the_word, 'spam') def testHasAttachments(self): self.entry.has_attachments = True - self.assertEquals(self.entry.has_attachments, True) + self.assertEqual(self.entry.has_attachments, True) def testLabel(self): self.entry.label = 'Trip reports' - self.assertEquals(self.entry.label, 'Trip reports') + self.assertEqual(self.entry.label, 'Trip reports') def testMarkHasRead(self): self.entry.mark_has_read = True - self.assertEquals(self.entry.mark_has_read, True) + self.assertEqual(self.entry.mark_has_read, True) def testArchive(self): self.entry.archive = True - self.assertEquals(self.entry.archive, True) + self.assertEqual(self.entry.archive, True) class EmailSettingsSendAsAliasTest(unittest.TestCase): @@ -86,19 +86,19 @@ def testName(self): self.entry.name = 'Sales' - self.assertEquals(self.entry.name, 'Sales') + self.assertEqual(self.entry.name, 'Sales') def testAddress(self): self.entry.address = 'sales@example.com' - self.assertEquals(self.entry.address, 'sales@example.com') + self.assertEqual(self.entry.address, 'sales@example.com') def testReplyTo(self): self.entry.reply_to = 'support@example.com' - self.assertEquals(self.entry.reply_to, 'support@example.com') + self.assertEqual(self.entry.reply_to, 'support@example.com') def testMakeDefault(self): self.entry.make_default = True - self.assertEquals(self.entry.make_default, True) + self.assertEqual(self.entry.make_default, True) class EmailSettingsWebClipTest(unittest.TestCase): @@ -108,7 +108,7 @@ def testEnable(self): self.entry.enable = True - self.assertEquals(self.entry.enable, True) + self.assertEqual(self.entry.enable, True) class EmailSettingsForwardingTest(unittest.TestCase): @@ -118,15 +118,15 @@ def testEnable(self): self.entry.enable = True - self.assertEquals(self.entry.enable, True) + self.assertEqual(self.entry.enable, True) def testForwardTo(self): self.entry.forward_to = 'fred@example.com' - self.assertEquals(self.entry.forward_to, 'fred@example.com') + self.assertEqual(self.entry.forward_to, 'fred@example.com') def testAction(self): self.entry.action = 'KEEP' - self.assertEquals(self.entry.action, 'KEEP') + self.assertEqual(self.entry.action, 'KEEP') class EmailSettingsPopTest(unittest.TestCase): @@ -136,15 +136,15 @@ def testEnable(self): self.entry.enable = True - self.assertEquals(self.entry.enable, True) + self.assertEqual(self.entry.enable, True) def testForwardTo(self): self.entry.enable_for = 'ALL_MAIL' - self.assertEquals(self.entry.enable_for, 'ALL_MAIL') + self.assertEqual(self.entry.enable_for, 'ALL_MAIL') def testAction(self): self.entry.action = 'KEEP' - self.assertEquals(self.entry.action, 'KEEP') + self.assertEqual(self.entry.action, 'KEEP') class EmailSettingsImapTest(unittest.TestCase): @@ -154,7 +154,7 @@ def testEnable(self): self.entry.enable = True - self.assertEquals(self.entry.enable, True) + self.assertEqual(self.entry.enable, True) class EmailSettingsVacationResponderTest(unittest.TestCase): @@ -164,31 +164,31 @@ def testEnable(self): self.entry.enable = True - self.assertEquals(self.entry.enable, True) + self.assertEqual(self.entry.enable, True) def testSubject(self): self.entry.subject = 'On vacation!' - self.assertEquals(self.entry.subject, 'On vacation!') + self.assertEqual(self.entry.subject, 'On vacation!') def testMessage(self): self.entry.message = 'See you on September 1st' - self.assertEquals(self.entry.message, 'See you on September 1st') + self.assertEqual(self.entry.message, 'See you on September 1st') def testStartDate(self): self.entry.start_date = '2011-12-05' - self.assertEquals(self.entry.start_date, '2011-12-05') + self.assertEqual(self.entry.start_date, '2011-12-05') def testEndDate(self): self.entry.end_date = '2011-12-06' - self.assertEquals(self.entry.end_date, '2011-12-06') + self.assertEqual(self.entry.end_date, '2011-12-06') def testContactsOnly(self): self.entry.contacts_only = True - self.assertEquals(self.entry.contacts_only, True) + self.assertEqual(self.entry.contacts_only, True) def testDomainOnly(self): self.entry.domain_only = True - self.assertEquals(self.entry.domain_only, True) + self.assertEqual(self.entry.domain_only, True) class EmailSettingsSignatureTest(unittest.TestCase): @@ -198,7 +198,7 @@ def testValue(self): self.entry.signature_value = 'Regards, Joe' - self.assertEquals(self.entry.signature_value, 'Regards, Joe') + self.assertEqual(self.entry.signature_value, 'Regards, Joe') class EmailSettingsLanguageTest(unittest.TestCase): @@ -208,7 +208,7 @@ def testLanguage(self): self.entry.language_tag = 'es' - self.assertEquals(self.entry.language_tag, 'es') + self.assertEqual(self.entry.language_tag, 'es') class EmailRefactoringTool: Refactored ./tests/gdata_tests/apps/data_test.py SettingsGeneralTest(unittest.TestCase): @@ -218,23 +218,23 @@ def testPageSize(self): self.entry.page_size = 25 - self.assertEquals(self.entry.page_size, 25) + self.assertEqual(self.entry.page_size, 25) def testShortcuts(self): self.entry.shortcuts = True - self.assertEquals(self.entry.shortcuts, True) + self.assertEqual(self.entry.shortcuts, True) def testArrows(self): self.entry.arrows = True - self.assertEquals(self.entry.arrows, True) + self.assertEqual(self.entry.arrows, True) def testSnippets(self): self.entry.snippets = True - self.assertEquals(self.entry.snippets, True) + self.assertEqual(self.entry.snippets, True) def testUnicode(self): self.entry.use_unicode = True - self.assertEquals(self.entry.use_unicode, True) + self.assertEqual(self.entry.use_unicode, True) def suite(): --- ./tests/gdata_tests/apps/data_test.py (original) +++ ./tests/gdata_tests/apps/data_test.py (refactored) @@ -36,41 +36,41 @@ gdata.apps.data.UserFeed) def testUserEntryFromString(self): - self.assert_(isinstance(self.entry, + self.assertTrue(isinstance(self.entry, gdata.apps.data.UserEntry)) - self.assertEquals(self.entry.name.given_name, 'abcd33') - self.assertEquals(self.entry.name.family_name, 'efgh3') - self.assertEquals(self.entry.login.user_name, 'abcd12310') - self.assertEquals(self.entry.login.suspended, 'false') - self.assertEquals(self.entry.login.admin, 'false') - self.assertEquals(self.entry.quota.limit, '25600') + self.assertEqual(self.entry.name.given_name, 'abcd33') + self.assertEqual(self.entry.name.family_name, 'efgh3') + self.assertEqual(self.entry.login.user_name, 'abcd12310') + self.assertEqual(self.entry.login.suspended, 'false') + self.assertEqual(self.entry.login.admin, 'false') + self.assertEqual(self.entry.quota.limit, '25600') def testUserFeedFromString(self): - self.assertEquals(len(self.feed.entry), 2) - self.assert_(isinstance(self.feed, gdata.apps.data.UserFeed)) - self.assert_(isinstance(self.feed.entry[0], gdata.apps.data.UserEntry)) - self.assert_(isinstance(self.feed.entry[1], gdata.apps.data.UserEntry)) - self.assertEquals(self.feed.entry[0].find_edit_link(), + self.assertEqual(len(self.feed.entry), 2) + self.assertTrue(isinstance(self.feed, gdata.apps.data.UserFeed)) + self.assertTrue(isinstance(self.feed.entry[0], gdata.apps.data.UserEntry)) + self.assertTrue(isinstance(self.feed.entry[1], gdata.apps.data.UserEntry)) + self.assertEqual(self.feed.entry[0].find_edit_link(), ('https://apps-apis.google.com/a/feeds/srkapps.com/user/2.0/user8306')) - self.assertEquals(self.feed.entry[0].name.given_name, 'FirstName8306') - self.assertEquals(self.feed.entry[0].name.family_name, 'LastName8306') - self.assertEquals(self.feed.entry[0].login.user_name, 'user8306') - self.assertEquals(self.feed.entry[0].login.admin, 'false') - self.assertEquals(self.feed.entry[0].login.suspended, 'false') - self.assertEquals(self.feed.entry[0].login.change_password, 'false') - self.assertEquals(self.feed.entry[0].login.ip_whitelisted, 'false') - self.assertEquals(self.feed.entry[0].quota.limit, '25600') - self.assertEquals( + self.assertEqual(self.feed.entry[0].name.given_name, 'FirstName8306') + self.assertEqual(self.feed.entry[0].name.family_name, 'LastName8306') + self.assertEqual(self.feed.entry[0].login.user_name, 'user8306') + self.assertEqual(self.feed.entry[0].login.admin, 'false') + self.assertEqual(self.feed.entry[0].login.suspended, 'false') + self.assertEqual(self.feed.entry[0].login.change_password, 'false') + self.assertEqual(self.feed.entry[0].login.ip_whitelisted, 'false') + self.assertEqual(self.feed.entry[0].quota.limit, '25600') + self.assertEqual( self.feed.entry[1].find_edit_link(), ('https://apps-apis.google.com/a/feeds/srkapps.com/user/2.0/user8307')) - self.assertEquals(self.feed.entry[1].name.given_name, 'FirstName8307') - self.assertEqualRefactoringTool: Refactored ./tests/gdata_tests/analytics/query_test.py s(self.feed.entry[1].name.family_name, 'LastName8307') - self.assertEquals(self.feed.entry[1].login.user_name, 'user8307') - self.assertEquals(self.feed.entry[1].login.admin, 'false') - self.assertEquals(self.feed.entry[1].login.suspended, 'false') - self.assertEquals(self.feed.entry[1].login.change_password, 'false') - self.assertEquals(self.feed.entry[1].login.ip_whitelisted, 'false') - self.assertEquals(self.feed.entry[1].quota.limit, '25600') + self.assertEqual(self.feed.entry[1].name.given_name, 'FirstName8307') + self.assertEqual(self.feed.entry[1].name.family_name, 'LastName8307') + self.assertEqual(self.feed.entry[1].login.user_name, 'user8307') + self.assertEqual(self.feed.entry[1].login.admin, 'false') + self.assertEqual(self.feed.entry[1].login.suspended, 'false') + self.assertEqual(self.feed.entry[1].login.change_password, 'false') + self.assertEqual(self.feed.entry[1].login.ip_whitelisted, 'false') + self.assertEqual(self.feed.entry[1].quota.limit, '25600') class NicknameEntryTest(unittest.TestCase): @@ -82,31 +82,31 @@ gdata.apps.data.NicknameFeed) def testNicknameEntryFromString(self): - self.assert_(isinstance(self.entry, + self.assertTrue(isinstance(self.entry, gdata.apps.data.NicknameEntry)) - self.assertEquals(self.entry.nickname.name, 'nehag') - self.assertEquals(self.entry.login.user_name, 'neha') + self.assertEqual(self.entry.nickname.name, 'nehag') + self.assertEqual(self.entry.login.user_name, 'neha') def testNicknameFeedFromString(self): - self.assertEquals(len(self.feed.entry), 2) - self.assert_(isinstance(self.feed, + self.assertEqual(len(self.feed.entry), 2) + self.assertTrue(isinstance(self.feed, gdata.apps.data.NicknameFeed)) - self.assert_(isinstance(self.feed.entry[0], + self.assertTrue(isinstance(self.feed.entry[0], gdata.apps.data.NicknameEntry)) - self.assert_(isinstance(self.feed.entry[1], + self.assertTrue(isinstance(self.feed.entry[1], gdata.apps.data.NicknameEntry)) - self.assertEquals( + self.assertEqual( self.feed.entry[0].find_edit_link(), ('https://apps-apis.google.com/a/feeds/srkapps.net/' 'nickname/2.0/nehag')) - self.assertEquals(self.feed.entry[0].nickname.name, 'nehag') - self.assertEquals(self.feed.entry[0].login.user_name, 'neha') - self.assertEquals( + self.assertEqual(self.feed.entry[0].nickname.name, 'nehag') + self.assertEqual(self.feed.entry[0].login.user_name, 'neha') + self.assertEqual( self.feed.entry[1].find_edit_link(), ('https://apps-apis.google.com/a/feeds/srkapps.net/' 'nickname/2.0/richag')) - self.assertEquals(self.feed.entry[1].nickname.name, 'richag') - self.assertEquals(self.feed.entry[1].login.user_name, 'richa') + self.assertEqual(self.feed.entry[1].nickname.name, 'richag') + self.assertEqual(self.feed.entry[1].login.user_name, 'richa') def suite(): --- ./tests/gdata_tests/analytics/query_test.py (original) +++ ./tests/gdata_tests/analytics/query_test.py (refactored) @@ -32,33 +32,33 @@ def testAccountFeed(self): """Tests Account Feed queries.""" queryTest1 = client.AccountFeedQuery() - self.assertEquals(str(queryTest1), + self.assertEqual(str(queryTest1), 'https://www.google.com/analytics/feeds/accounts/default') queryTest2 = client.AccountFeedQuery({'max-results': 50}) - self.assertEquals(str(queryTest2), + self.assertEqual(str(queryTest2), 'https://www.google.com/analytics/feeds/accounts/default' '?max-results=50') queryTest3 = client.AccountFeedQuery() queryTest3.query['max-results'] = 100 - self.assertEquals(str(queryTest3), + self.assertEqual(str(queryTest3), 'https://www.google.com/analytics/feeds/accounts/default' '?max-results=100') def testDataFeed(self): """Tests Data Feed queries.""" queryTest1 = client.DataFeedQuery() - self.assertEquals(str(queryTest1), + self.assertEqual(str(queryTest1), 'https://www.google.com/analytics/feeds/data') queryTest2 = client.DataFeedQuery({'ids': 'ga:1234'}) - self.assertEquals(str(queryTest2), + self.assertEqual(str(queryTest2), 'https://www.google.com/analytics/feeds/data?ids=ga%3A1234') queryTest3 = client.DataFeedQuery() queryTest3.query['ids'] = 'ga:1234' - self.assertEquals(str(queryTest3), + self.assertEqual(str(queryTest3), 'https://www.google.com/analytics/feeds/data?ids=ga%3A1234') @@ -72,40 +72,40 @@ def testAccountFeedQuery(self): """Tests Account Feed queries.""" queryTest1 = client.AccountQuery() - self.assertEquals(str(queryTest1), + self.assertEqual(str(queryTest1), '%s/accounts' % self.base_url) queryTest2 = client.AccountQuery({'max-results': 50}) - self.assertEquals(str(queryTest2), + self.assertEqual(str(queryTest2), '%s/accounts?max-results=50' % self.base_url) def testWebPropertyFeedQuery(self): """Tests Web Property Feed queries.""" queryTest1 = client.WebPropertyQuery() - self.assertEquals(str(queryTest1), + self.assertEqual(str(queryTest1), '%s/accounts/~all/webproperties' % self.base_url) queryTest2 = client.WebPropertyQuery('123') - self.assertEquals(str(queryTest2), + self.assertEqual(str(queryTest2), '%s/accounts/123/webproperties' % self.base_url) queryTest3 = client.WebPropertyQuery('123', {'max-results': 100}) - self.assertEquals(str(queryTest3), + self.assertEqual(str(queryTest3), '%s/accounts/123/webproperties?max-results=100' % self.base_url) def testProfileFeedQuery(self): """Tests Profile Feed queries.""" queryTest1 = client.ProfileQuery() - self.assertEquals(str(queryTest1), + self.assertEqual(str(queryTest1), '%s/accounts/~all/webproperties/~all/profiles' % self.base_url) queryTest2 = client.ProfileQuery('123', 'UA-123-1') - self.assertEquals(str(queryTest2), + self.assertEqual(str(queryTest2), '%s/accounts/123/webproperties/UA-123-1/profiles' % self.base_url) queryTest3 = client.ProfileQuery('123', 'UA-123-1', {'max-results': 100}) - self.assertEquals(str(queryTest3), + self.assertEqual(str(queryTest3), '%s/accounts/123/webproperties/UA-123-1/profiles?max-results=100' % self.base_url) @@ -113,25 +113,25 @@ queryTest4.acct_id = '123' queryTest4.web_prop_id = 'UA-123-1' queryTest4.query['max-results'] = 100 - self.assertEquals(str(queryTest4), + self.assertEqual(str(queryTest4), '%s/accounts/123/webproperties/UA-123-1/profiles?max-results=100' % self.base_url) def testGoalFeedQuery(self): """Tests Goal Feed queries.""" queryTest1 = client.GoalQuery() - self.assertEquals(str(queryTest1), + self.assertEqual(str(queryTest1), '%s/accounts/~all/webproperties/~all/profiles/~all/goals' % self.base_url) queryTest2 = client.GoalQuery('123', 'UA-123-1', '555') - self.assertEquals(str(queryTest2), + self.assertEqual(str(queryTest2), '%s/accounts/123/webproperties/UA-123-1/profiles/555/goals' % self.base_url) queryTest3 = client.GoalQuery('123', 'UA-123-1', '555', {'max-results': 100}) - self.assertEquals(str(queryTest3), + self.assertEqual(str(queryTest3), '%s/accounts/123/webproperties/UA-123-1/profiles/555/goals' '?max-results=100' % self.base_url) @@ -140,19 +140,19 @@ queryTest4.web_prop_id = 'UA-123-1' queryTest4.profile_id = '555' queryTest4.query['max-results'] = 100 - self.assertEquals(str(queryTest3), + self.assertEqual(str(queryTest3), '%s/accounts/123/webproperties/UA-123-1/profiles/555/goals' '?max-results=100' % self.base_url) def testAdvSegQuery(self): """Tests Advanced Segment Feed queries.""" queryTest1 = client.AdvSegQuery() - self.assertEquals(str(queryTest1), + self.assertEqual(str(queryTest1), '%s/segments' % self.base_url) RefactoringTool: Refactored ./tests/gdata_tests/analytics/live_client_test.py RefactoringTool: Refactored ./tests/gdata_tests/analytics/data_test.py queryTest2 = client.AdvSegQuery({'max-results': 100}) - self.assertEquals(str(queryTest2), + self.assertEqual(str(queryTest2), '%s/segments?max-results=100' % self.base_url) --- ./tests/gdata_tests/analytics/live_client_test.py (original) +++ ./tests/gdata_tests/analytics/live_client_test.py (refactored) @@ -62,7 +62,7 @@ }) feed = self.client.GetAccountFeed(account_query) - self.assert_(feed.entry is not None) + self.assertTrue(feed.entry is not None) properties = [ 'ga:accountId', @@ -76,7 +76,7 @@ entry = feed.entry[0] for prop in properties: property = entry.GetProperty(prop) - self.assertEquals(property.name, prop) + self.assertEqual(property.name, prop) def testDataFeed(self): """Tests if the Data Feed exists.""" @@ -98,10 +98,10 @@ }) feed = self.client.GetDataFeed(data_query) - self.assert_(feed.entry is not None) - self.assertEquals(feed.start_date.text, start_date) - self.assertEquals(feed.end_date.text, end_date) - self.assertEquals(feed.entry[0].GetMetric(metrics).name, metrics) + self.assertTrue(feed.entry is not None) + self.assertEqual(feed.start_date.text, start_date) + self.assertEqual(feed.end_date.text, end_date) + self.assertEqual(feed.entry[0].GetMetric(metrics).name, metrics) def testManagementFeed(self): """Tests of the Management Feed exists.""" @@ -113,7 +113,7 @@ account_query = gdata.analytics.client.AccountQuery() feed = self.client.GetManagementFeed(account_query) - self.assert_(feed.entry is not None) + self.assertTrue(feed.entry is not None) def tearDown(self): """Closes client connection.""" --- ./tests/gdata_tests/analytics/data_test.py (original) +++ ./tests/gdata_tests/analytics/data_test.py (refactored) @@ -49,95 +49,95 @@ """Tests Segment class in Google Analytics Account Feed.""" segment = self.feed.segment[0] - self.assertEquals(segment.id, 'gaid::-11') - self.assertEquals(segment.name, 'Visits from iPhones') + self.assertEqual(segment.id, 'gaid::-11') + self.assertEqual(segment.name, 'Visits from iPhones') def testSegmentDefinition(self): """Tests Definition class in Google Analytics Account Feed.""" definition = self.feed.segment[0].definition - self.assertEquals(definition.text, 'ga:operatingSystem==iPhone') + self.assertEqual(definition.text, 'ga:operatingSystem==iPhone') def testEntryTableId(self): """Tests custom classes in Google Analytics Account Feed.""" entry = self.feed.entry[0] - self.assertEquals(entry.table_id.text, 'ga:1174') + self.assertEqual(entry.table_id.text, 'ga:1174') def testEntryProperty(self): """Tests the property classes in Google Analytics Account Feed.""" property = self.feed.entry[0].property - self.assertEquals(property[0].name, 'ga:accountId') - self.assertEquals(property[0].value, '30481') - - self.assertEquals(property[1].name, 'ga:accountName') - self.assertEquals(property[1].value, 'Google Store') - - self.assertEquals(property[2].name, 'ga:profileId') - self.assertEquals(property[2].value, '1174') - - self.assertEquals(property[3].name, 'ga:webPropertyId') - self.assertEquals(property[3].value, 'UA-30481-1') - - self.assertEquals(property[4].name, 'ga:currency') - self.assertEquals(property[4].value, 'USD') - - self.assertEquals(property[5].name, 'ga:timezone') - self.assertEquals(property[5].value, 'America/Los_Angeles') + self.assertEqual(property[0].name, 'ga:accountId') + self.assertEqual(property[0].value, '30481') + + self.assertEqual(property[1].name, 'ga:accountName') + self.assertEqual(property[1].value, 'Google Store') + + self.assertEqual(property[2].name, 'ga:profileId') + self.assertEqual(property[2].value, '1174') + + self.assertEqual(property[3].name, 'ga:webPropertyId') + self.assertEqual(property[3].value, 'UA-30481-1') + + self.assertEqual(property[4].name, 'ga:currency') + self.assertEqual(property[4].value, 'USD') + + self.assertEqual(property[5].name, 'ga:timezone') + self.assertEqual(property[5].value, 'America/Los_Angeles') def testEntryGetProperty(self): """Tests GetProperty inherited class in the AccountEntry class.""" entry = self.feed.entry[0] - self.assertEquals(entry.GetProperty('ga:accountId').value, '30481') - self.assertEquals(entry.GetProperty('ga:accountName').value, 'Google Store') - self.assertEquals(entry.GetProperty('ga:profileId').value, '1174') - self.assertEquals(entry.GetProperty('ga:webPropertyId').value, 'UA-30481-1') - self.assertEquals(entry.GetProperty('ga:currency').value, 'USD') - self.assertEquals(entry.GetProperty('ga:timezone').value, 'America/Los_Angeles') + self.assertEqual(entry.GetProperty('ga:accountId').value, '30481') + self.assertEqual(entry.GetProperty('ga:accountName').value, 'Google Store') + self.assertEqual(entry.GetProperty('ga:profileId').value, '1174') + self.assertEqual(entry.GetProperty('ga:webPropertyId').value, 'UA-30481-1') + self.assertEqual(entry.GetProperty('ga:currency').value, 'USD') + self.assertEqual(entry.GetProperty('ga:timezone').value, 'America/Los_Angeles') def testGoal(self): """Tests Goal class in Google Anlaytics Account Feed.""" goal = self.feed.entry[0].goal[0] - self.assertEquals(goal.number, '1') - self.assertEquals(goal.name, 'Completing Order') - self.assertEquals(goal.value, '10.0') - self.assertEquals(goal.active, 'true') + self.assertEqual(goal.number, '1') + self.assertEqual(goal.name, 'Completing Order') + self.assertEqual(goal.value, '10.0') + self.assertEqual(goal.active, 'true') def testDestination(self): """Tests Destination class in Google Analytics Account Feed.""" destination = self.feed.entry[0].goal[0].destination - self.assertEquals(destination.expression, '/purchaseComplete.html') - self.assertEquals(destination.case_sensitive, 'false') - self.assertEquals(destination.match_type, 'regex') - self.assertEquals(destination.step1_required, 'false') + self.assertEqual(destination.expression, '/purchaseComplete.html') + self.assertEqual(destination.case_sensitive, 'false') + self.assertEqual(destination.match_type, 'regex') + self.assertEqual(destination.step1_required, 'false') def testStep(self): """Tests Step class in Google Analytics Account Feed.""" step = self.feed.entry[0].goal[0].destination.step[0] - self.assertEquals(step.number, '1') - self.assertEquals(step.name, 'View Product Categories') - self.assertEquals(step.path, '/Apps|Accessories|Fun|Kid\+s|Office') + self.assertEqual(step.number, '1') + self.assertEqual(step.name, 'View Product Categories') + self.assertEqual(step.path, '/Apps|Accessories|Fun|Kid\+s|Office') def testEngagemet(self): """Tests Engagement class in Google Analytics Account Feed.""" engagement = self.feed.entry[0].goal[1].engagement - self.assertEquals(engagement.type, 'timeOnSite') - self.assertEquals(engagement.comparison, '>') - self.assertEquals(engagement.threshold_value, '300') + self.assertEqual(engagement.type, 'timeOnSite') + self.assertEqual(engagement.comparison, '>') + self.assertEqual(engagement.threshold_value, '300') def testCustomVariable(self): """Tests CustomVariable class in Google Analytics Account Feed.""" customVar = self.feed.entry[0].custom_variable[0] - self.assertEquals(customVar.index, '1') - self.assertEquals(customVar.name, 'My Custom Variable') - self.assertEquals(customVar.scope, '3') + self.assertEqual(customVar.index, '1') + self.assertEqual(customVar.name, 'My Custom Variable') + self.assertEqual(customVar.scope, '3') class DataFeedTest(unittest.TestCase): @@ -152,124 +152,124 @@ def testDataFeed(self): """Tests custom classes in Google Analytics Data Feed.""" - self.assertEquals(self.feed.start_date.text, '2008-10-01') - self.assertEquals(self.feed.end_date.text, '2008-10-31') + self.assertEqual(self.feed.start_date.text, '2008-10-01') + self.assertEqual(self.feed.end_date.text, '2008-10-31') def testAggregates(self): """Tests Aggregates class in Google Analytics Data Feed.""" - self.assert_(self.feed.aggregates is not None) + self.assertTrue(self.feed.aggregates is not None) def testContainsSampledData(self): """Tests ContainsSampledData class in Google Analytics Data Feed.""" contains_sampled_data = self.feed.contains_sampled_data.text - self.assertEquals(contains_sampled_data, 'true') + self.assertEqual(contains_sampled_data, 'true') self.assertTrue(self.feed.HasSampledData()) def testAggregatesElements(self): """Tests Metrics class in Aggregates class.""" metric = self.feed.aggregates.metric[0] - self.assertEquals(metric.confidence_interval, '0.0') - self.assertEquals(metric.name, 'ga:visits') - self.assertEquals(metric.type, 'integer') - self.assertEquals(metric.value, '136540') + self.assertEqual(metric.confidence_interval, '0.0') + self.assertEqual(metric.name, 'ga:visits') + self.assertEqual(metric.type, 'integer') + self.assertEqual(metric.value, '136540') metric = self.feed.aggregates.GetMetric('ga:visits') - self.assertEquals(metric.confidence_interval, '0.0') - self.assertEquals(metric.name, 'ga:visits') - self.assertEquals(metric.type, 'integer') - self.assertEquals(metric.value, '136540') + self.assertEqual(metric.confidence_interval, '0.0') + self.assertEqual(metric.name, 'ga:visits') + self.assertEqual(metric.type, 'integer') + self.assertEqual(metric.value, '136540') def testDataSource(self): """Tests DataSources class in Google Analytics Data Feed.""" - self.assert_(self.feed.data_source[0] is not None) + self.assertTrue(self.feed.data_source[0] is not None) def testDataSourceTableId(self): """Tests TableId class in the DataSource class.""" table_id = self.feed.data_source[0].table_id - self.assertEquals(table_id.text, 'ga:1174') + self.assertEqual(table_id.text, 'ga:1174') def testDataSourceTableName(self): """Tests TableName class in the DataSource class.""" table_name = self.feed.data_source[0].table_name - self.assertEquals(table_name.text, 'www.googlestore.com') + self.assertEqual(table_name.text, 'www.googlestore.com') def testDataSourceProperty(self): """Tests Property class in the DataSource class.""" property = self.feed.data_source[0].property - self.assertEquals(property[0].name, 'ga:profileId') - self.assertEquals(property[0].value, '1174') - - self.assertEquals(property[1].name, 'ga:webPropertyId') - self.assertEquals(property[1].value, 'UA-30481-1') - - self.assertEquals(property[2].name, 'ga:accountName') - self.assertEquals(property[2].value, 'Google Store') + self.assertEqual(property[0].name, 'ga:profileId') + self.assertEqual(property[0].value, '1174') + + self.assertEqual(property[1].name, 'ga:webPropertyId') + self.assertEqual(property[1].value, 'UA-30481-1') + + self.assertEqual(property[2].name, 'ga:accountName') + self.assertEqual(property[2].value, 'Google Store') def testDataSourceGetProperty(self): """Tests GetProperty utility method in the DataSource class.""" ds = self.feed.data_source[0] - self.assertEquals(ds.GetProperty('ga:profileId').value, '1174') - self.assertEquals(ds.GetProperty('ga:webPropertyId').value, 'UA-30481-1') - self.assertEquals(ds.GetProperty('ga:accountName').value, 'Google Store') + self.assertEqual(ds.GetProperty('ga:profileId').value, '1174') + self.assertEqual(ds.GetProperty('ga:webPropertyId').value, 'UA-30481-1') + self.assertEqual(ds.GetProperty('ga:accountName').value, 'Google Store') def testSegment(self): """Tests Segment class in DataFeed class.""" segment = self.feed.segment - self.assertEquals(segment.id, 'gaid::-11') - self.assertEquals(segment.name, 'Visits from iPhones') + self.assertEqual(segment.id, 'gaid::-11') + self.assertEqual(segment.name, 'Visits from iPhones') def testSegmentDefinition(self): """Tests Definition class in Segment class.""" definition = self.feed.segment.definition - self.assertEquals(definition.text, 'ga:operatingSystem==iPhone') + self.assertEqual(definition.text, 'ga:operatingSystem==iPhone') def testEntryDimension(self): """Tests Dimension class in Entry class.""" dim = self.feed.entry[0].dimension[0] - self.assertEquals(dim.name, 'ga:source') - self.assertEquals(dim.value, 'blogger.com') + self.assertEqual(dim.name, 'ga:source') + self.assertEqual(dim.value, 'blogger.com') def testEntryGetDimension(self): """Tests GetDimension utility method in the Entry class.""" dim = self.feed.entry[0].GetDimension('ga:source') - self.assertEquals(dim.name, 'ga:source') - self.assertEquals(dim.value, 'blogger.com') + self.assertEqual(dim.name, 'ga:source') + self.assertEqual(dim.value, 'blogger.com') error = self.feed.entry[0].GetDimension('foo') - self.assertEquals(error, None) + self.assertEqual(error, None) def testEntryMetric(self): """Tests Metric class in Entry class.""" met = self.feed.entry[0].metric[0] - self.assertEquals(met.confidence_interval, '0.0') - self.assertEquals(met.name, 'ga:visits') - self.assertEquals(met.type, 'integer') - self.assertEquals(met.value, '68140') + self.assertEqual(met.confidence_interval, '0.0') + self.assertEqual(met.name, 'ga:visits') + self.assertEqual(met.type, 'integer') + self.assertEqual(met.value, '68140') def testEntryGetMetric(self): """Tests GetMetric utility method in the Entry class.""" met = self.feed.entry[0].GetMetric('ga:visits') - self.assertEquals(met.confidence_interval, '0.0') - self.assertEquals(met.name, 'ga:visits') - self.assertEquals(met.type, 'integer') - self.assertEquals(met.value, '68140') + self.assertEqual(met.confidence_interval, '0.0') + self.assertEqual(met.name, 'ga:visits') + self.assertEqual(met.type, 'integer') + self.assertEqual(met.value, '68140') error = self.feed.entry[0].GetMetric('foo') - self.assertEquals(error, None) + self.assertEqual(error, None) def testEntryGetObject(self): """Tests GetObjectOf utility method in Entry class.""" @@ -277,17 +277,17 @@ entry = self.feed.entry[0] dimension = entry.GetObject('ga:source') - self.assertEquals(dimension.name, 'ga:source') - self.assertEquals(dimension.value, 'blogger.com') + self.assertEqual(dimension.name, 'ga:source') + self.assertEqual(dimension.value, 'blogger.com') metric = entry.GetObject('ga:visits') - self.assertEquals(metric.name, 'ga:visits') - self.assertEquals(metric.value, '68140') - self.assertEquals(metric.type, 'integer') - self.assertEquals(metric.confidence_interval, '0.0') + self.assertEqual(metric.name, 'ga:visits') + self.assertEqual(metric.value, '68140') + self.assertEqual(metric.type, 'integer') + self.assertEqual(metric.confidence_interval, '0.0') error = entry.GetObject('foo') - self.assertEquals(error, None) + self.assertEqual(error, None) class ManagementFeedProfileTest(unittest.TestCase): @@ -318,37 +318,37 @@ """Tests property classes in Managment Entry class.""" property = self.feed.entry[0].property - self.assertEquals(property[0].name, 'ga:accountId') - self.assertEquals(property[0].value, '30481') + self.assertEqual(property[0].name, 'ga:accountId') + self.assertEqual(property[0].value, '30481') def testEntryGetProperty(self): """Tests GetProperty helper method in Management Entry class.""" entry = self.feed.entry[0] - self.assertEquals(entry.GetProperty('ga:accountId').value, '30481') + self.assertEqual(entry.GetProperty('ga:accountId').value, '30481') def testGetParentLinks(self): """Tests GetParentLinks utility method.""" parent_links = self.feed.entry[0].GetParentLinks() - self.assertEquals(len(parent_links), 1) + self.assertEqual(len(parent_links), 1) parent_link = parent_links[0] - self.assertEquals(parent_link.rel, + self.assertEqual(parent_link.rel, 'http://schemas.google.com/ga/2009#parent') - self.assertEquals(parent_link.type, + self.assertEqual(parent_link.type, 'application/atom+xml') - self.assertEquals(parent_link.href, + self.assertEqual(parent_link.href, 'https://www.google.com/analytics/feeds/datasources' '/ga/accounts/30481/webproperties/UA-30481-1') - self.assertEquals(parent_link.target_kind, + self.assertEqual(parent_link.target_kind, 'analytics#webproperty') def testGetChildLinks(self): """Tests GetChildLinks utility method.""" child_links = self.feed.entry[0].GetChildLinks() - self.assertEquals(len(child_links), 1) + self.assertEqual(len(child_links), 1) self.ChildLinkTestHelper(child_links[0]) @@ -359,19 +359,19 @@ self.ChildLinkTestHelper(child_link) child_link = self.feed.entry[0].GetChildLink('foo_bar') - self.assertEquals(child_link, None) + self.assertEqual(child_link, None) def ChildLinkTestHelper(self, child_link): """Common method to test a child link.""" - self.assertEquals(child_link.rel, + self.assertEqual(child_link.rel, 'http://schemas.google.com/ga/2009#child') - self.assertEquals(child_link.type, + self.assertEqual(child_link.type, 'application/atom+xml') - self.assertEquals(child_link.href, + self.assertEqual(child_link.href, 'https://www.google.com/analytics/feeds/datasources' '/ga/accounts/30481/webproperties/UA-30481-1/profiles/1174/goals') - self.assertEquals(child_link.target_kind, + self.assertEqual(child_link.target_kind, 'analytics#goals') @@ -388,35 +388,35 @@ """Tests Goal class in Google Anlaytics Account Feed.""" goal = self.feed.entry[0].goal - self.assertEquals(goal.number, '1') - self.assertEquals(goal.name, 'Completing Order') - self.assertEquals(goal.value, '10.0') - self.assertEquals(goal.active, 'true') + self.assertEqual(goal.number, '1') + self.assertEqual(goal.name, 'Completing Order') + self.assertEqual(goal.value, '10.0') + self.assertEqual(goal.active, 'true') def testGoalDestination(self): """Tests Destination class in Google Analytics Account Feed.""" destination = self.feed.entry[0].goal.destination - self.assertEquals(destination.expression, '/purchaseComplete.html') - self.assertEquals(destination.case_sensitive, 'false') - self.assertEquals(destination.match_type, 'regex') - self.assertEquals(destination.step1_required, 'false') + self.assertEqual(destination.expression, '/purchaseComplete.html') + self.assertEqual(destination.case_sensitive, 'false') + self.assertEqual(destination.match_type, 'regex') + self.assertEqual(destination.step1_required, 'false') def testGoalDestinationStep(self): """Tests Step class in Google Analytics Account Feed.""" step = self.feed.entry[0].goal.destination.step[0] - self.assertEquals(step.number, '1') - self.assertEquals(step.name, 'View Product Categories') - self.assertEquals(step.path, '/Apps|Accessories') + self.assertEqual(step.number, '1') + self.assertEqual(step.name, 'View Product Categories') + self.assertEqual(step.path, '/Apps|Accessories') def testGoalEngagemet(self): """Tests Engagement class in Google Analytics Account Feed.""" engagement = self.feed.entry[1].goal.engagement - self.assertEquals(engagement.type, 'timeOnSite') - self.assertEquals(engagement.comparison, '>') - self.assertEquals(engagement.threshold_value, '300') + self.assertEqual(engagement.type, 'timeOnSite') + self.assertEqual(engagement.comparison, '>') + self.assertEqual(engagement.threshold_value, '300') class ManagementFeedAdvSegTest(unittest.TestCase): @@ -432,14 +432,14 @@ """Tests Segment class in ManagementEntry class.""" segment = self.feed.entry[0].segment - self.assertEquals(segment.id, 'gaid::0'RefactoringTool: Refactored ./tests/gdata_test.py ) - self.assertEquals(segment.name, 'Sources Form Google') + self.assertEqual(segment.id, 'gaid::0') + self.assertEqual(segment.name, 'Sources Form Google') def testSegmentDefinition(self): """Tests Definition class in Segment class.""" definition = self.feed.entry[0].segment.definition - self.assertEquals(definition.text, 'ga:source=~^\Qgoogle\E') + self.assertEqual(definition.text, 'ga:source=~^\Qgoogle\E') def suite(): --- ./tests/gdata_test.py (original) +++ ./tests/gdata_test.py (refactored) @@ -36,9 +36,9 @@ def testToAndFromString(self): self.start_index.text = '1' - self.assert_(self.start_index.text == '1') + self.assertTrue(self.start_index.text == '1') new_start_index = gdata.StartIndexFromString(self.start_index.ToString()) - self.assert_(self.start_index.text == new_start_index.text) + self.assertTrue(self.start_index.text == new_start_index.text) class ItemsPerPageTest(unittest.TestCase): @@ -48,10 +48,10 @@ def testToAndFromString(self): self.items_per_page.text = '10' - self.assert_(self.items_per_page.text == '10') + self.assertTrue(self.items_per_page.text == '10') new_items_per_page = gdata.ItemsPerPageFromString( self.items_per_page.ToString()) - self.assert_(self.items_per_page.text == new_items_per_page.text) + self.assertTrue(self.items_per_page.text == new_items_per_page.text) class GDataEntryTest(unittest.TestCase): @@ -59,16 +59,16 @@ def testIdShouldBeCleaned(self): entry = gdata.GDataEntryFromString(test_data.XML_ENTRY_1) element_tree = ElementTree.fromstring(test_data.XML_ENTRY_1) - self.assert_(element_tree.findall( + self.assertTrue(element_tree.findall( '{http://www.w3.org/2005/Atom}id')[0].text != entry.id.text) - self.assert_(entry.id.text == 'http://www.google.com/test/id/url') + self.assertTrue(entry.id.text == 'http://www.google.com/test/id/url') def testGeneratorShouldBeCleaned(self): feed = gdata.GDataFeedFromString(test_data.GBASE_FEED) element_tree = ElementTree.fromstring(test_data.GBASE_FEED) - self.assert_(element_tree.findall('{http://www.w3.org/2005/Atom}generator' + self.assertTrue(element_tree.findall('{http://www.w3.org/2005/Atom}generator' )[0].text != feed.generator.text) - self.assert_(feed.generator.text == 'GoogleBase') + self.assertTrue(feed.generator.text == 'GoogleBase') def testAllowsEmptyId(self): entry = gdata.GDataEntry() @@ -84,28 +84,28 @@ self.entry = gdata.GDataEntryFromString(test_data.XML_ENTRY_1) def testLinkFinderGetsLicenseLink(self): - self.assertEquals(isinstance(self.entry.GetLicenseLink(), atom.Link), + self.assertEqual(isinstance(self.entry.GetLicenseLink(), atom.Link), True) - self.assertEquals(self.entry.GetLicenseLink().href, + self.assertEqual(self.entry.GetLicenseLink().href, 'http://creativecommons.org/licenses/by-nc/2.5/rdf') - self.assertEquals(self.entry.GetLicenseLink().rel, 'license') + self.assertEqual(self.entry.GetLicenseLink().rel, 'license') def testLinkFinderGetsAlternateLink(self): - self.assertEquals(isinstance(self.entry.GetAlternateLink(), atom.Link), + self.assertEqual(isinstance(self.entry.GetAlternateLink(), atom.Link), True) - self.assertEquals(self.entry.GetAlternateLink().href, + self.assertEqual(self.entry.GetAlternateLink().href, 'http://www.provider-host.com/123456789') - self.assertEquals(self.entry.GetAlternateLink().rel, 'alternate') + self.assertEqual(self.entry.GetAlternateLink().rel, 'alternate') class GDataFeedTest(unittest.TestCase): def testCorrectConversionToElementTree(self): test_feed = gdata.GDataFeedFromString(test_data.GBASE_FEED) - self.assert_(test_feed.total_results is not None) + self.assertTrue(test_feed.total_results is not None) element_tree = test_feed._ToElementTree() feed = element_tree.find('{http://www.w3.org/2005/Atom}feed') - self.assert_(element_tree.find( + self.assertTrue(element_tree.find( '{http://a9.com/-/spec/opensearchrss/1.0/}totalResults') is not None) def testAllowsEmptyId(self): @@ -121,23 +121,23 @@ def testCorrectConversionFromAndToString(self): batch_entry = gdata.BatchEntryFromString(test_data.BATCH_ENTRY) - self.assertEquals(batch_entry.batch_id.text, 'itemB') - self.assertEquals(batch_entry.id.text, + self.assertEqual(batch_entry.batch_id.text, 'itemB') + self.assertEqual(batch_entry.id.text, 'http://www.google.com/base/feeds/items/' '2173859253842813008') - self.assertEquals(batch_entry.batch_operation.type, 'insert') - self.assertEquals(batch_entry.batch_status.code, '201') - self.assertEquals(batch_entry.batch_status.reason, 'Created') + self.assertEqual(batch_entry.batch_operation.type, 'insert') + self.assertEqual(batch_entry.batch_status.code, '201') + self.assertEqual(batch_entry.batch_status.reason, 'Created') new_entry = gdata.BatchEntryFromString(str(batch_entry)) - self.assertEquals(batch_entry.batch_id.text, new_entry.batch_id.text) - self.assertEquals(batch_entry.id.text, new_entry.id.text) - self.assertEquals(batch_entry.batch_operation.type, + self.assertEqual(batch_entry.batch_id.text, new_entry.batch_id.text) + self.assertEqual(batch_entry.id.text, new_entry.id.text) + self.assertEqual(batch_entry.batch_operation.type, new_entry.batch_operation.type) - self.assertEquals(batch_entry.batch_status.code, + self.assertEqual(batch_entry.batch_status.code, new_entry.batch_status.code) - self.assertEquals(batch_entry.batch_status.reason, + self.assertEqual(batch_entry.batch_status.reason, new_entry.batch_status.reason) @@ -151,44 +151,44 @@ def testConvertRequestFeed(self): batch_feed = gdata.BatchFeedFromString(test_data.BATCH_FEED_REQUEST) - self.assertEquals(len(batch_feed.entry), 4) + self.assertEqual(len(batch_feed.entry), 4) for entry in batch_feed.entry: - self.assert_(isinstance(entry, gdata.BatchEntry)) - self.assertEquals(batch_feed.title.text, 'My Batch Feed') + self.assertTrue(isinstance(entry, gdata.BatchEntry)) + self.assertEqual(batch_feed.title.text, 'My Batch Feed') new_feed = gdata.BatchFeedFromString(str(batch_feed)) - self.assertEquals(len(new_feed.entry), 4) + self.assertEqual(len(new_feed.entry), 4) for entry in new_feed.entry: - self.assert_(isinstance(entry, gdata.BatchEntry)) - self.assertEquals(new_feed.title.text, 'My Batch Feed') + self.assertTrue(isinstance(entry, gdata.BatchEntry)) + self.assertEqual(new_feed.title.text, 'My Batch Feed') def testConvertResultFeed(self): batch_feed = gdata.BatchFeedFromString(test_data.BATCH_FEED_RESULT) - self.assertEquals(len(batch_feed.entry), 4) + self.assertEqual(len(batch_feed.entry), 4) for entry in batch_feed.entry: - self.assert_(isinstance(entry, gdata.BatchEntry)) + self.assertTrue(isinstance(entry, gdata.BatchEntry)) if entry.id.text == ('http://www.google.com/base/feeds/items/' '2173859253842813008'): - self.assertEquals(entry.batch_operation.type, 'insert') - self.assertEquals(entry.batch_id.text, 'itemB') - self.assertEquals(entry.batch_status.code, '201') - self.assertEquals(entry.batch_status.reason, 'Created') - self.assertEquals(batch_feed.title.text, 'My Batch') + self.assertEqual(entry.batch_operation.type, 'insert') + self.assertEqual(entry.batch_id.text, 'itemB') + self.assertEqual(entry.batch_status.code, '201') + self.assertEqual(entry.batch_status.reason, 'Created') + self.assertEqual(batch_feed.title.text, 'My Batch') new_feed = gdata.BatchFeedFromString(str(batch_feed)) - self.assertEquals(len(new_feed.entry), 4) + self.assertEqual(len(new_feed.entry), 4) for entry in new_feed.entry: - self.assert_(isinstance(entry, gdata.BatchEntry)) + self.assertTrue(isinstance(entry, gdata.BatchEntry)) if entry.id.text == ('http://www.google.com/base/feeds/items/' '2173859253842813008'): - self.assertEquals(entry.batch_operation.type, 'insert') - self.assertEquals(entry.batch_id.text, 'itemB') - self.assertEquals(entry.batch_status.code, '201') - self.assertEquals(entry.batch_status.reason, 'Created') - self.assertEquals(new_feed.title.text, 'My Batch') + self.assertEqual(entry.batch_operation.type, 'insert') + self.assertEqual(entry.batch_id.text, 'itemB') + self.assertEqual(entry.batch_status.code, '201') + self.assertEqual(entry.batch_status.reason, 'Created') + self.assertEqual(new_feed.title.text, 'My Batch') def testAddBatchEntry(self): try: @@ -199,43 +199,43 @@ new_entry = self.batch_feed.AddBatchEntry( id_url_string='http://example.com/1') - self.assertEquals(len(self.batch_feed.entry), 1) - self.assertEquals(self.batch_feed.entry[0].id.text, + self.assertEqual(len(self.batch_feed.entry), 1) + self.assertEqual(self.batch_feed.entry[0].id.text, 'http://example.com/1') - self.assertEquals(self.batch_feed.entry[0].batch_id.text, '0') - self.assertEquals(new_entry.id.text, 'http://example.com/1') - self.assertEquals(new_entry.batch_id.text, '0') + self.assertEqual(self.batch_feed.entry[0].batch_id.text, '0') + self.assertEqual(new_entry.id.text, 'http://example.com/1') + self.assertEqual(new_entry.batch_id.text, '0') to_add = gdata.BatchEntry(atom_id=atom.Id(text='originalId')) new_entry = self.batch_feed.AddBatchEntry(entry=to_add, batch_id_string='foo') - self.assertEquals(new_entry.batch_id.text, 'foo') - self.assertEquals(new_entry.id.text, 'originalId') + self.assertEqual(new_entry.batch_id.text, 'foo') + self.assertEqual(new_entry.id.text, 'originalId') to_add = gdata.BatchEntry(atom_id=atom.Id(text='originalId'), batch_id=gdata.BatchId(text='bar')) new_entry = self.batch_feed.AddBatchEntry(entry=to_add, id_url_string='newId', batch_id_string='foo') - self.assertEquals(new_entry.batch_id.text, 'foo') - self.assertEquals(new_entry.id.text, 'originalId') + self.assertEqual(new_entry.batch_id.text, 'foo') + self.assertEqual(new_entry.id.text, 'originalId') to_add = gdata.BatchEntry(atom_id=atom.Id(text='originalId'), batch_id=gdata.BatchId(text='bar')) new_entry = self.batch_feed.AddBatchEntry(entry=to_add, id_url_string='newId') - self.assertEquals(new_entry.batch_id.text, 'bar') - self.assertEquals(new_entry.id.text, 'originalId') + self.assertEqual(new_entry.batch_id.text, 'bar') + self.assertEqual(new_entry.id.text, 'originalId') to_add = gdata.BatchEntry(atom_id=atom.Id(text='originalId'), batch_id=gdata.BatchId(text='bar'), batch_operation=gdata.BatchOperation( op_type=gdata.BATCH_INSERT)) - self.assertEquals(to_add.batch_operation.type, gdata.BATCH_INSERT) + self.assertEqual(to_add.batch_operation.type, gdata.BATCH_INSERT) new_entry = self.batch_feed.AddBatchEntry(entry=to_add, id_url_string='newId', batch_id_string='foo', operation_string=gdata.BATCH_UPDATE) - self.assertEquals(new_entry.batch_operation.type, gdata.BATCH_UPDATE) + self.assertEqual(new_entry.batch_operation.type, gdata.BATCH_UPDATE) def testAddInsert(self): @@ -243,16 +243,16 @@ first_entry = gdata.BatchEntry( atom_id=atom.Id(text='http://example.com/1'), text='This is a test1') self.batch_feed.AddInsert(first_entry) - self.assertEquals(self.batch_feed.entry[0].batch_operation.type, + self.assertEqual(self.batch_feed.entry[0].batch_operation.type, gdata.BATCH_INSERT) - self.assertEquals(self.batch_feed.entry[0].batch_id.text, '0') + self.assertEqual(self.batch_feed.entry[0].batch_id.text, '0') second_entry = gdata.BatchEntry( atom_id=atom.Id(text='http://example.com/2'), text='This is a test2') self.batch_feed.AddInsert(second_entry, batch_id_string='foo') - self.assertEquals(self.batch_feed.entry[1].batch_operation.type, + self.assertEqual(self.batch_feed.entry[1].batch_operation.type, gdata.BATCH_INSERT) - self.assertEquals(self.batch_feed.entry[1].batch_id.text, 'foo') + self.assertEqual(self.batch_feed.entry[1].batch_id.text, 'foo') third_entry = gdata.BatchEntry( @@ -263,44 +263,44 @@ self.batch_feed.AddInsert(third_entry) # The batch entry should not have the original operation, it should # have been changed to an insert. - self.assertEquals(self.batch_feed.entry[2].batch_operation.type, + self.assertEqual(self.batch_feed.entry[2].batch_operation.type, gdata.BATCH_INSERT) - self.assertEquals(self.batch_feed.entry[2].batch_id.text, '2') + self.assertEqual(self.batch_feed.entry[2].batch_id.text, '2') def testAddDelete(self): # Try deleting an entry delete_entry = gdata.BatchEntry( atom_id=atom.Id(text='http://example.com/1'), text='This is a test') self.batch_feed.AddDelete(entry=delete_entry) - self.assertEquals(self.batch_feed.entry[0].batch_operation.type, + self.assertEqual(self.batch_feed.entry[0].batch_operation.type, gdata.BATCH_DELETE) - self.assertEquals(self.batch_feed.entry[0].id.text, + self.assertEqual(self.batch_feed.entry[0].id.text, 'http://example.com/1') - self.assertEquals(self.batch_feed.entry[0].text, 'This is a test') + self.assertEqual(self.batch_feed.entry[0].text, 'This is a test') # Try deleting a URL self.batch_feed.AddDelete(url_string='http://example.com/2') - self.assertEquals(self.batch_feed.entry[0].batch_operation.type, + self.assertEqual(self.batch_feed.entry[0].batch_operation.type, gdata.BATCH_DELETE) - self.assertEquals(self.batch_feed.entry[1].id.text, + self.assertEqual(self.batch_feed.entry[1].id.text, 'http://example.com/2') - self.assert_(self.batch_feed.entry[1].text is None) + self.assertTrue(self.batch_feed.entry[1].text is None) def testAddQuery(self): # Try querying with an existing batch entry delete_entry = gdata.BatchEntry( atom_id=atom.Id(text='http://example.com/1')) self.batch_feed.AddQuery(entry=delete_entry) - self.assertEquals(self.batch_feed.entry[0].batch_operation.type, + self.assertEqual(self.batch_feed.entry[0].batch_operation.type, gdata.BATCH_QUERY) - self.assertEquals(self.batch_feed.entry[0].id.text, + self.assertEqual(self.batch_feed.entry[0].id.text, 'http://example.com/1') # Try querying a URL self.batch_feed.AddQuery(url_string='http://example.com/2') - self.assertEquals(self.batch_feed.entry[0].batch_operation.type, + self.assertEqual(self.batch_feed.entry[0].batch_operation.type, gdata.BATCH_QUERY) - self.assertEquals(self.batch_feed.entry[1].id.text, + self.assertEqual(self.batch_feed.entry[1].id.text, 'http://example.com/2') def testAddUpdate(self): @@ -308,11 +308,11 @@ delete_entry = gdata.BatchEntry( atom_id=atom.Id(text='http://example.com/1'), text='This is a test') self.batch_feed.AddUpdate(entry=delete_entry) - self.assertEquals(self.batch_feed.entry[0].batch_operation.type, + self.assertEqual(self.batch_feed.entry[0].batch_operation.type, gdata.BATCH_UPDATE) - self.assertEquals(self.batch_feed.entry[0].id.text, + self.assertEquaRefactoringTool: Refactored ./tests/coverage.py l(self.batch_feed.entry[0].id.text, 'http://example.com/1') - self.assertEquals(self.batch_feed.entry[0].text, 'This is a test') + self.assertEqual(self.batch_feed.entry[0].text, 'This is a test') class ExtendedPropertyTest(unittest.TestCase): @@ -321,28 +321,28 @@ ep = gdata.ExtendedProperty(name='blobby') ep.SetXmlBlob('') extension = ep.GetXmlBlobExtensionElement() - self.assertEquals(extension.tag, 'some_xml') - self.assert_(extension.namespace is None) - self.assertEquals(extension.attributes['attr'], 'test') + self.assertEqual(extension.tag, 'some_xml') + self.assertTrue(extension.namespace is None) + self.assertEqual(extension.attributes['attr'], 'test') ep2 = gdata.ExtendedPropertyFromString(ep.ToString()) extension = ep2.GetXmlBlobExtensionElement() - self.assertEquals(extension.tag, 'some_xml') - self.assert_(extension.namespace is None) - self.assertEquals(extension.attributes['attr'], 'test') + self.assertEqual(extension.tag, 'some_xml') + self.assertTrue(extension.namespace is None) + self.assertEqual(extension.attributes['attr'], 'test') def testGettersShouldReturnNoneWithNoBlob(self): ep = gdata.ExtendedProperty(name='no blob') - self.assert_(ep.GetXmlBlobExtensionElement() is None) - self.assert_(ep.GetXmlBlobString() is None) + self.assertTrue(ep.GetXmlBlobExtensionElement() is None) + self.assertTrue(ep.GetXmlBlobString() is None) def testGettersReturnCorrectTypes(self): ep = gdata.ExtendedProperty(name='has blob') ep.SetXmlBlob('') - self.assert_(isinstance(ep.GetXmlBlobExtensionElement(), + self.assertTrue(isinstance(ep.GetXmlBlobExtensionElement(), atom.ExtensionElement)) - self.assert_(isinstance(ep.GetXmlBlobString(), str)) + self.assertTrue(isinstance(ep.GetXmlBlobString(), str)) class FeedLinkTest(unittest.TestCase): @@ -350,7 +350,7 @@ def testCorrectFromStringType(self): link = gdata.FeedLinkFromString( '') - self.assert_(isinstance(link, gdata.FeedLink)) + self.assertTrue(isinstance(link, gdata.FeedLink)) self.assertEqual(link.count_hint, '5') --- ./tests/coverage.py (original) +++ ./tests/coverage.py (refactored) @@ -46,6 +46,7 @@ import re import string import sys +import atexit import types @@ -110,16 +111,16 @@ def __init__(self): global the_coverage if the_coverage: - raise self.error, "Only one coverage object allowed." + raise self.error("Only one coverage object allowed.") self.cache = os.environ.get(self.cache_env, self.cache_default) self.restore() self.analysis_cache = {} def help(self, error=None): if error: - print error - print - print __doc__ + print(error) + print() + print(__doc__) sys.exit(1) def command_line(self): @@ -135,14 +136,14 @@ '-r': 'report', '-x': 'execute', } - short_opts = string.join(map(lambda o: o[1:], optmap.keys()), '') - long_opts = optmap.values() + short_opts = string.join([o[1:] for o in list(optmap.keys())], '') + long_opts = list(optmap.values()) options, args = getopt.getopt(sys.argv[1:], short_opts, long_opts) for o, a in options: - if optmap.has_key(o): + if o in optmap: settings[optmap[o]] = 1 - elif optmap.has_key(o + ':'): + elif o + ':' in optmap: settings[optmap[o + ':']] = a elif o[2:] in long_opts: settings[o[2:]] = 1 @@ -179,9 +180,9 @@ # script, change sys.path so that it matches what the script # would have found if it had been run normally. sys.path[0] = os.path.dirname(sys.argv[0]) - execfile(sys.argv[0], __main__.__dict__) + exec(compile(open(sys.argv[0], "rb").read(), sys.argv[0], 'exec'), __main__.__dict__) if not args: - args = self.cexecuted.keys() + args = list(self.cexecuted.keys()) ignore_errors = settings.get('ignore-errors') show_missing = settings.get('show-missing') directory = settings.get('directory=') @@ -227,7 +228,7 @@ import marshal cexecuted = marshal.load(cache) cache.close() - if isinstance(cexecuted, types.DictType): + if isinstance(cexecuted, dict): self.cexecuted = cexecuted except: pass @@ -237,7 +238,7 @@ # normalized case). See [GDR 2001-12-04b, 3.3]. def canonical_filename(self, filename): - if not self.canonical_filename_cache.has_key(filename): + if filename not in self.canonical_filename_cache: f = filename if os.path.isabs(f) and not os.path.exists(f): f = os.path.basename(f) @@ -257,9 +258,9 @@ def canonicalize_filenames(self): global c - for filename, lineno in c.keys(): + for filename, lineno in list(c.keys()): f = self.canonical_filename(filename) - if not self.cexecuted.has_key(f): + if f not in self.cexecuted: self.cexecuted[f] = {} self.cexecuted[f][lineno] = 1 c = {} @@ -269,7 +270,7 @@ def morf_filename(self, morf): if isinstance(morf, types.ModuleType): if not hasattr(morf, '__file__'): - raise self.error, "Module has no __file__ attribute." + raise self.error("Module has no __file__ attribute.") file = morf.__file__ else: file = morf @@ -282,24 +283,24 @@ # in the source code. def analyze_morf(self, morf): - if self.analysis_cache.has_key(morf): + if morf in self.analysis_cache: return self.analysis_cache[morf] filename = self.morf_filename(morf) ext = os.path.splitext(filename)[1] if ext == '.pyc': if not os.path.exists(filename[0:-1]): - raise self.error, ("No source for compiled code '%s'." + raise self.error("No source for compiled code '%s'." % filename) filename = filename[0:-1] elif ext != '.py': - raise self.error, "File '%s' not Python source." % filename + raise self.error("File '%s' not Python source." % filename) source = open(filename, 'r') import parser tree = parser.suite(source.read()).totuple(1) source.close() statements = {} self.find_statements(tree, statements) - lines = statements.keys() + lines = list(statements.keys()) lines.sort() result = filename, lines self.analysis_cache[morf] = result @@ -372,16 +373,16 @@ else: return "%d-%d" % (start, end) import string - return string.join(map(stringify, pairs), ", ") + return string.join(list(map(stringify, pairs)), ", ") def analysis(self, morf): filename, statements = self.analyze_morf(morf) self.canonicalize_filenames() - if not self.cexecuted.has_key(filename): + if filename not in self.cexecuted: self.cexecuted[filename] = {} missing = [] for line in statements: - if not self.cexecuted[filename].has_key(line): + if line not in self.cexecuted[filename]: missing.append(line) return (filename, statements, missing, self.format_lines(statements, missing)) @@ -393,9 +394,9 @@ return os.path.splitext(os.path.basename(morf))[0] def report(self, morfs, show_missing=1, ignore_errors=0): - if not isinstance(morfs, types.ListType): + if not isinstance(morfs, list): morfsRefactoringTool: Refactored ./tests/atom_tests/url_test.py = [morfs] - max_name = max([5,] + map(len, map(self.morf_name, morfs))) + max_name = max([5,] + list(map(len, list(map(self.morf_name, morfs))))) fmt_name = "%%- %ds " % max_name fmt_err = fmt_name + "%s: %s" header = fmt_name % "Name" + " Stmts Exec Cover" @@ -403,8 +404,8 @@ if show_missing: header = header + " Missing" fmt_coverage = fmt_coverage + " %s" - print header - print "-" * len(header) + print(header) + print("-" * len(header)) total_statements = 0 total_executed = 0 for morf in morfs: @@ -420,7 +421,7 @@ args = (name, n, m, pc) if show_missing: args = args + (readable,) - print fmt_coverage % args + print(fmt_coverage % args) total_statements = total_statements + n total_executed = total_executed + m except KeyboardInterrupt: @@ -428,9 +429,9 @@ except: if not ignore_errors: type, msg = sys.exc_info()[0:2] - print fmt_err % (name, type, msg) + print(fmt_err % (name, type, msg)) if len(morfs) > 1: - print "-" * len(header) + print("-" * len(header)) if total_statements > 0: pc = 100.0 * total_executed / total_statements else: @@ -438,7 +439,7 @@ args = ("TOTAL", total_statements, total_executed, pc) if show_missing: args = args + ("",) - print fmt_coverage % args + print(fmt_coverage % args) # annotate(morfs, ignore_errors). @@ -503,11 +504,11 @@ the_coverage = coverage() # Module functions call methods in the singleton object. -def start(*args, **kw): return apply(the_coverage.start, args, kw) -def stop(*args, **kw): return apply(the_coverage.stop, args, kw) -def erase(*args, **kw): return apply(the_coverage.erase, args, kw) -def analysis(*args, **kw): return apply(the_coverage.analysis, args, kw) -def report(*args, **kw): return apply(the_coverage.report, args, kw) +def start(*args, **kw): return the_coverage.start(*args, **kw) +def stop(*args, **kw): return the_coverage.stop(*args, **kw) +def erase(*args, **kw): return the_coverage.erase(*args, **kw) +def analysis(*args, **kw): return the_coverage.analysis(*args, **kw) +def report(*args, **kw): return the_coverage.report(*args, **kw) # Save coverage data when Python exits. (The atexit module wasn't # introduced until Python 2.0, so use sys.exitfunc when it's not @@ -516,7 +517,7 @@ import atexit atexit.register(the_coverage.save) except ImportError: - sys.exitfunc = the_coverage.save + atexit.register(the_coverage.save) # Command-line interface. if __name__ == '__main__': --- ./tests/atom_tests/url_test.py (original) +++ ./tests/atom_tests/url_test.py (refactored) @@ -27,48 +27,48 @@ def testParseUrl(self): url = atom.url.parse_url('http://www.google.com/calendar/feeds') - self.assert_(url.protocol == 'http') - self.assert_(url.port is None) - self.assert_(url.host == 'www.google.com') - self.assert_(url.path == '/calendar/feeds') - self.assert_(url.params == {}) + self.assertTrue(url.protocol == 'http') + self.assertTrue(url.port is None) + self.assertTrue(url.host == 'www.google.com') + self.assertTrue(url.path == '/calendar/feeds') + self.assertTrue(url.params == {}) url = atom.url.parse_url('http://example.com:6091/calendar/feeds') - self.assert_(url.protocol == 'http') - self.assert_(url.host == 'example.com') - self.assert_(url.port == '6091') - self.assert_(url.path == '/calendar/feeds') - self.assert_(url.params == {}) + self.assertTrue(url.protocol == 'http') + self.assertTrue(url.host == 'example.com') + self.assertTrue(url.port == '6091') + self.assertTrue(url.path == '/calendar/feeds') + self.assertTrue(url.params == {}) url = atRefactoringTool: Refactored ./tests/atom_tests/token_store_test.py om.url.parse_url('/calendar/feeds?foo=bar') - self.assert_(url.protocol is None) - self.assert_(url.host is None) - self.assert_(url.path == '/calendar/feeds') - self.assert_(len(url.params.keys()) == 1) - self.assert_('foo' in url.params) - self.assert_(url.params['foo'] == 'bar') + self.assertTrue(url.protocol is None) + self.assertTrue(url.host is None) + self.assertTrue(url.path == '/calendar/feeds') + self.assertTrue(len(list(url.params.keys())) == 1) + self.assertTrue('foo' in url.params) + self.assertTrue(url.params['foo'] == 'bar') url = atom.url.parse_url('/calendar/feeds?my+foo=bar%3Dx') - self.assert_(len(url.params.keys()) == 1) - self.assert_('my foo' in url.params) - self.assert_(url.params['my foo'] == 'bar=x') + self.assertTrue(len(list(url.params.keys())) == 1) + self.assertTrue('my foo' in url.params) + self.assertTrue(url.params['my foo'] == 'bar=x') def testUrlToString(self): url = atom.url.Url(port=80) url.host = 'example.com' - self.assert_(str(url), '//example.com:80') + self.assertTrue(str(url), '//example.com:80') url = atom.url.Url(protocol='http', host='example.com', path='/feed') url.params['has spaces'] = 'sneaky=values?&!' - self.assert_(url.to_string() == ( + self.assertTrue(url.to_string() == ( 'http://example.com/feed?has+spaces=sneaky%3Dvalues%3F%26%21')) def testGetRequestUri(self): url = atom.url.Url(protocol='http', host='example.com', path='/feed') url.params['has spaces'] = 'sneaky=values?&!' - self.assert_(url.get_request_uri() == ( + self.assertTrue(url.get_request_uri() == ( '/feed?has+spaces=sneaky%3Dvalues%3F%26%21')) - self.assert_(url.get_param_string() == ( + self.assertTrue(url.get_param_string() == ( 'has+spaces=sneaky%3Dvalues%3F%26%21')) def testComparistons(self): @@ -76,16 +76,16 @@ params={'x':'1', 'y':'2'}) url2 = atom.url.Url(host='example.com', port=80, path='/feed', params={'y':'2', 'x':'1'}) - self.assertEquals(url1, url2) + self.assertEqual(url1, url2) url3 = atom.url.Url(host='example.com', port=81, path='/feed', params={'x':'1', 'y':'2'}) - self.assert_(url1 != url3) - self.assert_(url2 != url3) + self.assertTrue(url1 != url3) + self.assertTrue(url2 != url3) url4 = atom.url.Url(protocol='ftp', host='example.com', path='/feed', params={'x':'1', 'y':'2'}) - self.assert_(url1 != url4) - self.assert_(url2 != url4) - self.assert_(url3 != url4) + self.assertTrue(url1 != url4) + self.assertTrue(url2 != url4) + self.assertTrue(url3 != url4) def suite(): --- ./tests/atom_tests/token_store_test.py (original) +++ ./tests/atom_tests/token_store_test.py (refactored) @@ -33,23 +33,23 @@ self.tokens.add_token(self.token) def testAddAndFindTokens(self): - self.assert_(self.tokens.find_token('http://example.com/') == self.token) - self.assert_(self.tokens.find_token('http://example.org/') == self.token) - self.assert_(self.tokens.find_token('http://example.org/foo?ok=1') == ( + self.assertTrue(self.tokens.find_token('http://example.com/') == self.token) + self.assertTrue(self.tokens.find_token('http://example.org/') == self.token) + self.assertTrue(self.tokens.find_token('http://example.org/foo?ok=1') == ( self.token)) - self.assert_(isinstance(self.tokens.find_token('http://example.net/'), + self.assertTrue(isinstance(self.tokens.find_token('http://example.net/'), atom.http_interface.GenericToken)) - self.assert_(isinstance(self.tokens.find_token('example.com/'), + self.assertTrue(isinstance(self.tokens.find_token('example.com/'), atom.http_interface.GenericToken)) def testFindTokenUsingMultipleUrls(self): - self.assert_(self.tokens.find_token( + self.assertTrue(self.tokens.find_token( 'http://example.com/') == self.token) - self.assert_(self.tokens.find_token( + sRefactoringTool: Refactored ./tests/atom_tests/service_test.py elf.assertTrue(self.tokens.find_token( 'http://example.org/bar') == self.token) - self.assert_(isinstance(self.tokens.find_token(''), + self.assertTrue(isinstance(self.tokens.find_token(''), atom.http_interface.GenericToken)) - self.assert_(isinstance(self.tokens.find_token( + self.assertTrue(isinstance(self.tokens.find_token( 'http://example.net/'), atom.http_interface.GenericToken)) @@ -59,14 +59,14 @@ atom.url.Url(host='www.example.net')]) token_store = atom.token_store.TokenStore() token_store.add_token(token) - self.assert_(token_store.find_token( + self.assertTrue(token_store.find_token( 'http://www.example.com/foobar') == token) - self.assert_(token_store.find_token( + self.assertTrue(token_store.find_token( 'https://www.example.com:443/foobar') == token) - self.assert_(token_store.find_token( + self.assertTrue(token_store.find_token( 'http://www.example.net/xyz') == token) - self.assert_(token_store.find_token('http://www.example.org/') != token) - self.assert_(isinstance(token_store.find_token('http://example.org/'), + self.assertTrue(token_store.find_token('http://www.example.org/') != token) + self.assertTrue(isinstance(token_store.find_token('http://example.org/'), atom.http_interface.GenericToken)) --- ./tests/atom_tests/service_test.py (original) +++ ./tests/atom_tests/service_test.py (refactored) @@ -26,121 +26,121 @@ def testBuildUriWithNoParams(self): x = atom.service.BuildUri('/base/feeds/snippets') - self.assert_(x == '/base/feeds/snippets') + self.assertTrue(x == '/base/feeds/snippets') def testBuildUriWithParams(self): # Add parameters to a URI x = atom.service.BuildUri('/base/feeds/snippets', url_params={'foo': 'bar', 'bq': 'digital camera'}) - self.assert_(x == '/base/feeds/snippets?foo=bar&bq=digital+camera') - self.assert_(x.startswith('/base/feeds/snippets')) - self.assert_(x.count('?') == 1) - self.assert_(x.count('&') == 1) - self.assert_(x.index('?') < x.index('&')) - self.assert_(x.index('bq=digital+camera') != -1) + self.assertTrue(x == '/base/feeds/snippets?foo=bar&bq=digital+camera') + self.assertTrue(x.startswith('/base/feeds/snippets')) + self.assertTrue(x.count('?') == 1) + self.assertTrue(x.count('&') == 1) + self.assertTrue(x.index('?') < x.index('&')) + self.assertTrue(x.index('bq=digital+camera') != -1) # Add parameters to a URI that already has parameters x = atom.service.BuildUri('/base/feeds/snippets?bq=digital+camera', url_params={'foo': 'bar', 'max-results': '250'}) - self.assert_(x.startswith('/base/feeds/snippets?bq=digital+camera')) - self.assert_(x.count('?') == 1) - self.assert_(x.count('&') == 2) - self.assert_(x.index('?') < x.index('&')) - self.assert_(x.index('max-results=250') != -1) - self.assert_(x.index('foo=bar') != -1) + self.assertTrue(x.startswith('/base/feeds/snippets?bq=digital+camera')) + self.assertTrue(x.count('?') == 1) + self.assertTrue(x.count('&') == 2) + self.assertTrue(x.index('?') < x.index('&')) + self.assertTrue(x.index('max-results=250') != -1) + self.assertTrue(x.index('foo=bar') != -1) def testBuildUriWithoutParameterEscaping(self): x = atom.service.BuildUri('/base/feeds/snippets', url_params={'foo': ' bar', 'bq': 'digital camera'}, escape_params=False) - self.assert_(x.index('foo= bar') != -1) - self.assert_(x.index('bq=digital camera') != -1) + self.assertTrue(x.index('foo= bar') != -1) + self.assertTrue(x.index('bq=digital camera') != -1) def testParseHttpUrl(self): atom_service = atom.service.AtomService('code.google.com') - self.assertEquals(atom_service.server, 'code.google.com') + self.assertEqual(atom_service.server, 'code.google.com') (host, port, ssl, path) = atom.service.ProcessUrl(atom_service, 'http://www.google.com/service/subservice?name=value') - self.assertEquals(ssl, False) - self.assertEquals(host, 'www.google.com') - self.assertEquals(port, 80) - self.assertEquals(path, '/service/subservice?name=value') + self.assertEqual(ssl, False) + self.assertEqual(host, 'www.google.com') + self.assertEqual(port, 80) + self.assertEqual(path, '/service/subservice?name=value') def testParseHttpUrlWithPort(self): atom_service = atom.service.AtomService('code.google.com') - self.assertEquals(atom_service.server, 'code.google.com') + self.assertEqual(atom_service.server, 'code.google.com') (host, port, ssl, path) = atom.service.ProcessUrl(atom_service, 'http://www.google.com:12/service/subservice?name=value&newname=newvalue') - self.assertEquals(ssl, False) - self.assertEquals(host, 'www.google.com') - self.assertEquals(port, 12) - self.assert_(path.startswith('/service/subservice?')) - self.assert_(path.find('name=value') >= len('/service/subservice?')) - self.assert_(path.find('newname=newvalue') >= len('/service/subservice?')) + self.assertEqual(ssl, False) + self.assertEqual(host, 'www.google.com') + self.assertEqual(port, 12) + self.assertTrue(path.startswith('/service/subservice?')) + self.assertTrue(path.find('name=value') >= len('/service/subservice?')) + self.assertTrue(path.find('newname=newvalue') >= len('/service/subservice?')) def testParseHttpsUrl(self): atom_service = atom.service.AtomService('code.google.com') - self.assertEquals(atom_service.server, 'code.google.com') + self.assertEqual(atom_service.server, 'code.google.com') (host, port, ssl, path) = atom.service.ProcessUrl(atom_service, 'https://www.google.com/service/subservice?name=value&newname=newvalue') - self.assertEquals(ssl, True) - self.assertEquals(host, 'www.google.com') - self.assertEquals(port, 443) - self.assert_(path.startswith('/service/subservice?')) - self.assert_(path.find('name=value') >= len('/service/subservice?')) - self.assert_(path.find('newname=newvalue') >= len('/service/subservice?')) + self.assertEqual(ssl, True) + self.assertEqual(host, 'www.google.com') + self.assertEqual(port, 443) + self.assertTrue(path.startswith('/service/subservice?')) + self.assertTrue(path.find('name=value') >= len('/service/subservice?')) + self.assertTrue(path.find('newname=newvalue') >= len('/service/subservice?')) def testParseHttpsUrlWithPort(self): atom_service = atom.service.AtomService('code.google.com') - self.assertEquals(atom_service.server, 'code.google.com') + self.assertEqual(atom_service.server, 'code.google.com') (host, port, ssl, path) = atom.service.ProcessUrl(atom_service, 'https://www.google.com:13981/service/subservice?name=value&newname=newvalue') - self.assertEquals(ssl, True) - self.assertEquals(host, 'www.google.com') - self.assertEquals(port, 13981) - self.assert_(path.startswith('/service/subservice?')) - self.assert_(path.find('name=value') >= len('/service/subservice?')) - self.assert_(path.find('newname=newvalue') >= len('/service/subservice?')) + self.assertEqual(ssl, True) + self.assertEqual(host, 'www.google.com') + self.assertEqual(port, 13981) + self.assertTrue(path.startswith('/service/subservice?')) + self.assertTrue(path.find('name=value') >= len('/service/subservice?')) + self.assertTrue(path.find('newname=newvalue') >= len('/service/subservice?')) def testSetBasicAuth(self): client = atom.service.AtomService() client.UseBasicAuth('foo', 'bar') token = client.token_store.find_token('http://') - self.assert_(isinstance(token, atom.service.BasicAuthToken)) - self.assertEquals(token.auth_header, 'Basic Zm9vOmJhcg==') + self.assertTrue(isinstance(token, atom.service.BasicAuthToken)) + self.assertEqual(token.auth_header, 'Basic Zm9vOmJhcg==') client.UseBasicAuth('','') token = client.token_store.find_token('http://') - self.assert_(isinstance(toRefactoringTool: Refactored ./tests/atom_tests/mock_server_test.py ken, atom.service.BasicAuthToken)) - self.assertEquals(token.auth_header, 'Basic Og==') + self.assertTrue(isinstance(token, atom.service.BasicAuthToken)) + self.assertEqual(token.auth_header, 'Basic Og==') def testProcessUrlWithStringForService(self): (server, port, ssl, uri) = atom.service.ProcessUrl( service='www.google.com', url='/base/feeds/items') - self.assertEquals(server, 'www.google.com') - self.assertEquals(port, 80) - self.assertEquals(ssl, False) - self.assert_(uri.startswith('/base/feeds/items')) + self.assertEqual(server, 'www.google.com') + self.assertEqual(port, 80) + self.assertEqual(ssl, False) + self.assertTrue(uri.startswith('/base/feeds/items')) client = atom.service.AtomService() client.server = 'www.google.com' client.ssl = True (server, port, ssl, uri) = atom.service.ProcessUrl( service=client, url='/base/feeds/items') - self.assertEquals(server, 'www.google.com') - self.assertEquals(ssl, True) - self.assert_(uri.startswith('/base/feeds/items')) + self.assertEqual(server, 'www.google.com') + self.assertEqual(ssl, True) + self.assertTrue(uri.startswith('/base/feeds/items')) (server, port, ssl, uri) = atom.service.ProcessUrl(service=None, url='https://www.google.com/base/feeds/items') - self.assertEquals(server, 'www.google.com') - self.assertEquals(port, 443) - self.assertEquals(ssl, True) - self.assert_(uri.startswith('/base/feeds/items')) + self.assertEqual(server, 'www.google.com') + self.assertEqual(port, 443) + self.assertEqual(ssl, True) + self.assertTrue(uri.startswith('/base/feeds/items')) def testHostHeaderContainsNonDefaultPort(self): client = atom.service.AtomService() --- ./tests/atom_tests/mock_server_test.py (original) +++ ./tests/atom_tests/mock_server_test.py (refactored) @@ -45,10 +45,10 @@ 'Header2':'1', 'Header3':'c'}) bad_verb = atom.mock_service.MockRequest('POST', 'http://www.google.com', data='post data', extra_headers={'Header1':'a', 'Header2':'b'}) - self.assertEquals(self.request_thumbprint.IsMatch(matching_request), True) - self.assertEquals(self.request_thumbprint.IsMatch(bad_url), False) - self.assertEquals(self.request_thumbprint.IsMatch(bad_header), True) - self.assertEquals(self.request_thumbprint.IsMatch(bad_verb), False) + self.assertEqual(self.request_thumbprint.IsMatch(matching_request), True) + self.assertEqual(self.request_thumbprint.IsMatch(bad_url), False) + self.assertEqual(self.request_thumbprint.IsMatch(bad_header), True) + self.assertEqual(self.request_thumbprint.IsMatch(bad_verb), False) class HttpRequestTest(unittest.TestCase): @@ -65,14 +65,14 @@ atom.mock_service.recordings.append((recorded_request, recorded_response)) # Try a couple of GET requests which should match the recorded request. response = self.client.Get('http://example.com/', converter=str) - self.assertEquals(response, 'Got it') + self.assertEqual(response, 'Got it') self.client.server = 'example.com' raw_response = self.client.handler.HttpRequest(self.client, 'GET', None, '/') - self.assertEquals(raw_response.read(), 'Got it') - self.assertEquals(raw_response.status, 200) - self.assertEquals(raw_response.reason, 'OK') + self.assertEqual(raw_response.read(), 'Got it') + self.assertEqual(raw_response.status, 200) + self.assertEqual(raw_response.reason, 'OK') class RecordRealHttpRequestsTest(unittest.TestCase): @@ -88,9 +88,9 @@ # Enter 'replay' mode atom.mock_service.real_request_handler = None mock_response = atom.mock_service.HttpRequest(client, 'GET', None, 'http://www.google.com/') - self.assertEquals(real_response.reason, mock_response.reason) - self.assertEquals(real_response.status, mock_response.status) - self.assertEquals(real_response.read(), mock_response.read()) + self.assertEqual(real_response.reason, mock_response.reason) + self.assertEqual(real_response.status, mock_response.sRefactoringTool: Refactored ./tests/atom_tests/mock_http_test.py RefactoringTool: Refactored ./tests/atom_tests/mock_http_core_test.py tatus) + self.assertEqual(real_response.read(), mock_response.read()) if __name__ == '__main__': --- ./tests/atom_tests/mock_http_test.py (original) +++ ./tests/atom_tests/mock_http_test.py (refactored) @@ -36,9 +36,9 @@ response = self.client.request('GET', 'http://example.com/hooray') - self.assertEquals(len(self.client.recordings), 1) - self.assertEquals(response.status, 200) - self.assertEquals(response.read(), 'Hooray!') + self.assertEqual(len(self.client.recordings), 1) + self.assertEqual(response.status, 200) + self.assertEqual(response.read(), 'Hooray!') def testRecordResponse(self): # Turn on pass-through record mode. @@ -46,8 +46,8 @@ live_response = self.client.request('GET', 'https://www.blogger.com/feeds/7986894085536788407/posts/default?max-results=1') live_response_body = live_response.read() - self.assertEquals(live_response.status, 200) - self.assertEquals(live_response_body.startswith('hi'), + request.add_body_part(io.StringIO('hi'), 'text/html', len('hi')) request.add_body_part('alert("Greetings!")', 'text/javascript') response = client.request(request) - self.assert_(response.getheader('Echo-Host') == 'www.jeffscudder.com:8080') - self.assert_( + self.assertTrue(response.getheader('Echo-Host') == 'www.jeffscudder.com:8080') + self.assertTrue( response.getheader('Echo-Uri') == '/multipart?test=true&happy=yes') - self.assert_(response.getheader('Echo-Scheme') == 'https') - self.assert_(response.getheader('Echo-Method') == 'POST') - self.assert_(response.getheader('Content-Type') == ( + self.assertTrue(response.getheader('Echo-Scheme') == 'https') + self.assertTrue(response.getheader('Echo-Method') == 'POST') + self.assertTrue(response.getheader('Content-Type') == ( 'multipart/related; boundary="%s"' % (atom.http_core.MIME_BOUNDARY,))) expected_body = ('Media multipart posting' '\r\n--%s\r\n' @@ -86,8 +86,8 @@ '\r\n--%s--') % (atom.http_core.MIME_BOUNDARY, atom.http_core.MIME_BOUNDARY, atom.http_core.MIME_BOUNDARY, atom.http_core.MIME_BOUNDARY,) - self.assert_(response.read() == expected_body) - self.assert_(response.getheader('Content-Length') == str( + self.assertTrue(response.read() == expected_body) + self.assertTrue(response.getheader('Content-Length') == str( len(expected_body))) @@ -101,9 +101,9 @@ atom.http_core.parse_uri('http://www.google.com/').modify_request(request) self.client.add_response(request, 200, 'OK', body='Testing') response = self.client.request(request) - self.assert_(response.status == 200) - self.assert_(response.reason == 'OK') - self.assert_(response.read() == 'Testing') + self.assertTrue(response.status == 200) + self.assertTrue(response.reason == 'OK') + self.assertTrue(response.read() == 'Testing') def test_save_and_load_recordings(self): request = atom.http_core.HttpRequest(method='GET') @@ -119,9 +119,9 @@ pass self.client._load_recordings('test_save_and_load_recordings') response = self.client.request(request) - self.assert_(response.status == 200) - self.assert_(response.reason == 'OK') - self.assert_(response.read() == 'Testing') + self.assertTrue(response.status == 200) + self.assertTrue(response.reason == 'OK') + self.assertTrue(response.read() == 'Testing') def test_use_recordings(self): request = atom.http_core.HttpRequest(method='GET') @@ -131,32 +131,32 @@ response = self.client.request(request) if self.client.real_client: self.client._save_recordings('test_use_recordings') - self.assert_(response.status in (200, 302)) - self.assert_(response.reason in ('OK', 'Found')) - self.assert_(response.getheader('server') == 'gws') + self.assertTrue(response.status in (200, 302)) + self.assertTrue(response.reason in ('OK', 'Found')) + self.assertTrue(response.getheader('server') == 'gws') body = response.read() - self.assert_(body.startswith('') or + self.assertTrue(body.startswith('') or body.startswith('')) def test_match_request(self): x = atom.http_core.HttpRequest('http://example.com/', 'GET') y = atom.http_core.HttpRequest('http://example.com/', 'GET') - self.assert_(atom.mock_http_core._match_request(x, y)) + self.assertTrue(atom.mock_http_core._match_request(x, y)) y = atom.http_core.HttpRequest('http://example.com/', 'POST') - self.assert_(not atom.mock_http_core._match_request(x, y)) + self.assertTrue(not atom.mock_http_core._match_request(x, y)) y = atom.http_core.HttpRequest('http://example.com/1', 'GET') - self.assert_(not atom.mock_http_core._match_request(x, y)) + self.assertTrue(not atom.mock_http_core._match_request(x, y)) y = atom.http_core.HttpRequest('http://example.com/?gsessionid=1', 'GET') - self.assert_(not atom.mock_http_core._match_request(x, y)) + self.assertTruRefactoringTool: Refactored ./tests/atom_tests/mock_client_test.py RefactoringTool: Refactored ./tests/atom_tests/http_interface_test.py RefactoringTool: Refactored ./tests/atom_tests/http_core_test.py e(not atom.mock_http_core._match_request(x, y)) y = atom.http_core.HttpRequest('http://example.com/?start_index=1', 'GET') - self.assert_(atom.mock_http_core._match_request(x, y)) + self.assertTrue(atom.mock_http_core._match_request(x, y)) x = atom.http_core.HttpRequest('http://example.com/?gsessionid=1', 'GET') y = atom.http_core.HttpRequest('http://example.com/?gsessionid=1', 'GET') - self.assert_(atom.mock_http_core._match_request(x, y)) + self.assertTrue(atom.mock_http_core._match_request(x, y)) y = atom.http_core.HttpRequest('http://example.com/?gsessionid=2', 'GET') - self.assert_(not atom.mock_http_core._match_request(x, y)) + self.assertTrue(not atom.mock_http_core._match_request(x, y)) y = atom.http_core.HttpRequest('http://example.com/', 'GET') - self.assert_(not atom.mock_http_core._match_request(x, y)) + self.assertTrue(not atom.mock_http_core._match_request(x, y)) def test_use_named_sessions(self): self.client._delete_recordings('mock_http_test.test_use_named_sessions') @@ -172,9 +172,9 @@ # Modify the recorded response to allow us to identify a cached result # from an echoed result. We need to be able to check to see if this # came from a recording. - self.assert_('Cache-Marker' not in self.client._recordings[0][1]._headers) + self.assertTrue('Cache-Marker' not in self.client._recordings[0][1]._headers) self.client._recordings[0][1]._headers['Cache-Marker'] = '1' - self.assert_('Cache-Marker' in self.client._recordings[0][1]._headers) + self.assertTrue('Cache-Marker' in self.client._recordings[0][1]._headers) # Save the recorded responses. self.client.close_session() --- ./tests/atom_tests/mock_client_test.py (original) +++ ./tests/atom_tests/mock_client_test.py (refactored) @@ -36,9 +36,9 @@ response = self.client.request('GET', 'http://example.com/hooray') - self.assertEquals(len(self.client.recordings), 1) - self.assertEquals(response.status, 200) - self.assertEquals(response.read(), 'Hooray!') + self.assertEqual(len(self.client.recordings), 1) + self.assertEqual(response.status, 200) + self.assertEqual(response.read(), 'Hooray!') def testRecordResponse(self): # Turn on pass-through record mode. @@ -46,8 +46,8 @@ live_response = self.client.request('GET', 'http://www.google.com/base/feeds/snippets?max-results=1') live_response_body = live_response.read() - self.assertEquals(live_response.status, 200) - self.assertEquals(live_response_body.startswith('body2', 'text/html') copied = request._copy() - self.assert_(request.uri.scheme == copied.uri.scheme) - self.assert_(request.uri.host == copied.uri.host) - self.assert_(request.method == copied.method) - self.assert_(request.uri.path == copied.uri.path) - self.assert_(request.headers == copied.headers) - self.assert_(request._body_parts == copied._body_parts) + self.assertTrue(request.uri.scheme == copied.uri.scheme) + self.assertTrue(request.uri.host == copied.uri.host) + self.assertTrue(request.method == copied.method) + self.assertTrue(request.uri.path == copied.uri.path) + self.assertTrue(request.headers == copied.headers) + self.assertTrue(request._body_parts == copied._body_parts) copied.headers['test'] = '2' copied._body_parts[1] = 'body3' - self.assert_(request.headers != copied.headers) - self.assert_(request._body_parts != copied._body_parts) + self.assertTrue(request.headers != copied.headers) + self.assertTrue(request._body_parts != copied._body_parts) def suite(): --- ./tests/atom_tests/data_test.py (original) +++ ./tests/atom_tests/data_test.py (refactored) @@ -56,9 +56,9 @@ self.author = atom.data.Author() def testEmptyAuthorShouldHaveEmptyExtensionLists(self): - self.assert_(isinstance(self.author._other_elements, list)) + self.assertTrue(isinstance(self.author._other_elements, list)) self.assertEqual(len(self.author._other_elements), 0) - self.assert_(isinstance(self.author._other_attributes, dict)) + self.assertTrue(isinstance(self.author._other_attributes, dict)) self.assertEqual(len(self.author._other_attributes), 0) def testNormalAuthorShouldHaveNoExtensionElements(self): @@ -143,7 +143,7 @@ self.assertEqual(string_from_name, string_from_new_name) def testText(self): - self.assert_(self.name.text is None) + self.assertTrue(self.name.text is None) self.name.text = 'Jeff Scudder' self.assertEqual(self.name.text, 'Jeff Scudder') new_name = atom.core.parse(self.name.to_string(), atom.data.Name) @@ -177,27 +177,27 @@ atom.data.ExtensionElement) self.assertEqual(deep_tree.tag, 'feed') self.assertEqual(deep_tree.namespace, 'http://www.w3.org/2005/Atom') - self.assert_(deep_tree.children[0].tag == 'author') - self.assert_(deep_tree.children[0].namespace == 'http://www.google.com') - self.assert_(deep_tree.children[0].children[0].tag == 'name') - self.assert_(deep_tree.children[0].children[0].namespace == + self.assertTrue(deep_tree.children[0].tag == 'author') + self.assertTrue(deep_tree.children[0].namespace == 'http://www.google.com') + self.assertTrue(deep_tree.children[0].children[0].tag == 'name') + self.assertTrue(deep_tree.children[0].children[0].namespace == 'http://www.google.com') - self.assert_(deep_tree.children[0].children[0].text.strip() == 'John Doe') - self.assert_(deep_tree.children[0].children[0].children[0].text.strip() == + self.assertTrue(deep_tree.children[0].children[0].text.strip() == 'John Doe') + self.assertTrue(deep_tree.children[0].children[0].children[0].text.strip() == 'Bar') foo = deep_tree.children[0].children[0].children[0] - self.assert_(foo.tag == 'foo') - self.assert_(foo.namespace == 'http://www.google.com') - self.assert_(foo.attributes['up'] == 'down') - self.assert_(foo.attributes['yes'] == 'no') - self.assert_(foo.children == []) + self.assertTrue(foo.tag == 'foo') + self.assertTrue(foo.namespace == 'http://www.google.com') + self.assertTrue(foo.attributes['up'] == 'down') + self.assertTrue(foo.attributes['yes'] == 'no') + self.assertTrue(foo.children == []) def testEEToAndFromStringShouldMatch(self): string_from_ee = self.ee.ToString() new_ee = atom.core.xml_element_from_string(string_from_ee, atom.data.ExtensionElement) string_from_new_ee = new_ee.ToString() - self.assert_(string_from_ee == string_from_new_ee) + self.assertTrue(string_from_ee == string_from_new_ee) deep_tree = atom.core.xml_element_from_string(self.EXTENSION_TREE, atom.data.ExtensionElement) @@ -205,7 +205,7 @@ new_deep_tree = atom.core.xml_element_from_string(string_from_deep_tree, atom.data.ExtensionElement) string_from_new_deep_tree = new_deep_tree.ToString() - self.assert_(string_from_deep_tree == string_from_new_deep_tree) + self.assertTrue(string_from_deep_tree == string_from_new_deep_tree) class LinkTest(unittest.TestCase): @@ -218,15 +218,15 @@ self.link.hreflang = 'english' self.link.type = 'text/html' self.link.extension_attributes['foo'] = 'bar' - self.assert_(self.link.href == 'test href') - self.assert_(self.link.hreflang == 'english') - self.assert_(self.link.type == 'text/html') - self.assert_(self.link.extension_attributes['foo'] == 'bar') + self.assertTrue(self.link.href == 'test href') + self.assertTrue(self.link.hreflang == 'english') + self.assertTrue(self.link.type == 'text/html') + self.assertTrue(self.link.extension_attributes['foo'] == 'bar') new_link = atom.core.parse(self.link.ToString(), atom.data.Link) - self.assert_(self.link.href == new_link.href) - self.assert_(self.link.type == new_link.type) - self.assert_(self.link.hreflang == new_link.hreflang) - self.assert_(self.link.extension_attributes['foo'] == + self.assertTrue(self.link.href == new_link.href) + self.assertTrue(self.link.type == new_link.type) + self.assertTrue(self.link.hreflang == new_link.hreflang) + self.assertTrue(self.link.extension_attributes['foo'] == new_link.extension_attributes['foo']) def testLinkType(self): @@ -243,13 +243,13 @@ self.generator.uri = 'www.google.com' self.generator.version = '1.0' self.generator.extension_attributes['foo'] = 'bar' - self.assert_(self.generator.uri == 'www.google.com') - self.assert_(self.generator.version == '1.0') - self.assert_(self.generator.extension_attributes['foo'] == 'bar') + self.assertTrue(self.generator.uri == 'www.google.com') + self.assertTrue(self.generator.version == '1.0') + self.assertTrue(self.generator.extension_attributes['foo'] == 'bar') new_generator = atom.core.parse(self.generator.ToString(), atom.data.Generator) - self.assert_(self.generator.uri == new_generator.uri) - self.assert_(self.generator.version == new_generator.version) - self.assert_(self.generator.extension_attributes['foo'] == + self.assertTrue(self.generator.uri == new_generator.uri) + self.assertTrue(self.generator.version == new_generator.version) + self.assertTrue(self.generator.extension_attributes['foo'] == new_generator.extension_attributes['foo']) @@ -261,11 +261,11 @@ def testTitleToAndFromString(self): self.title.type = 'text' self.title.text = 'Less: <' - self.assert_(self.title.type == 'text') - self.assert_(self.title.text == 'Less: <') + self.assertTrue(self.title.type == 'text') + self.assertTrue(self.title.text == 'Less: <') new_title = atom.core.parse(str(self.title), atom.data.Title) - self.assert_(self.title.type == new_title.type) - self.assert_(self.title.text == new_title.text) + self.assertTrue(self.title.type == new_title.type) + self.assertTrue(self.title.text == new_title.text) class SubtitleTest(unittest.TestCase): @@ -276,12 +276,12 @@ def testTitleToAndFromString(self): self.subtitle.type = 'text' self.subtitle.text = 'sub & title' - self.assert_(self.subtitle.type == 'text') - self.assert_(self.subtitle.text == 'sub & title') + self.assertTrue(self.subtitle.type == 'text') + self.assertTrue(self.subtitle.text == 'sub & title') new_subtitle = atom.core.parse(self.subtitle.ToString(), atom.data.Subtitle) - self.assert_(self.subtitle.type == new_subtitle.type) - self.assert_(self.subtitle.text == new_subtitle.text) + self.assertTrue(self.subtitle.type == new_subtitle.type) + self.assertTrue(self.subtitle.text == new_subtitle.text) class SummaryTest(unittest.TestCase): @@ -292,11 +292,11 @@ def testTitleToAndFromString(self): self.summary.type = 'text' self.summary.text = 'Less: <' - self.assert_(self.summary.type == 'text') - self.assert_(self.summary.text == 'Less: <') + self.assertTrue(self.summary.type == 'text') + self.assertTrue(self.summary.text == 'Less: <') new_summary = atom.core.parse(self.summary.ToString(), atom.data.Summary) - self.assert_(self.summary.type == new_summary.type) - self.assert_(self.summary.text == new_summary.text) + self.assertTrue(self.summary.type == new_summary.type) + self.assertTrue(self.summary.text == new_summary.text) class CategoryTest(unittest.TestCase): @@ -308,14 +308,14 @@ self.category.term = 'x' self.category.scheme = 'y' self.category.label = 'z' - self.assert_(self.category.term == 'x') - self.assert_(self.category.scheme == 'y') - self.assert_(self.category.label == 'z') + self.assertTrue(self.category.term == 'x') + self.assertTrue(self.category.scheme == 'y') + self.assertTrue(self.category.label == 'z') new_category = atom.core.parse(self.category.to_string(), atom.data.Category) - self.assert_(self.category.term == new_category.term) - self.assert_(self.category.scheme == new_category.scheme) - self.assert_(self.category.label == new_category.label) + self.assertTrue(self.category.term == new_category.term) + self.assertTrue(self.category.scheme == new_category.scheme) + self.assertTrue(self.category.label == new_category.label) class ContributorTest(unittest.TestCase): @@ -327,14 +327,14 @@ self.contributor.name = atom.data.Name(text='J Scud') self.contributor.email = atom.data.Email(text='nobody@nowhere') self.contributor.uri = atom.data.Uri(text='http://www.google.com') - self.assert_(self.contributor.name.text == 'J Scud') - self.assert_(self.contributor.email.text == 'nobody@nowhere') - self.assert_(self.contributor.uri.text == 'http://www.google.com') + self.assertTrue(self.contributor.name.text == 'J Scud') + self.assertTrue(self.contributor.email.text == 'nobody@nowhere') + self.assertTrue(self.contributor.uri.text == 'http://www.google.com') new_contributor = atom.core.parse(self.contributor.ToString(), atom.data.Contributor) - self.assert_(self.contributor.name.text == new_contributor.name.text) - self.assert_(self.contributor.email.text == new_contributor.email.text) - self.assert_(self.contributor.uri.text == new_contributor.uri.text) + self.assertTrue(self.contributor.name.text == new_contributor.name.text) + self.assertTrue(self.contributor.email.text == new_contributor.email.text) + self.assertTrue(self.contributor.uri.text == new_contributor.uri.text) class IdTest(unittest.TestCase): @@ -344,9 +344,9 @@ def testIdToAndFromString(self): self.my_id.text = 'my nifty id' - self.assert_(self.my_id.text == 'my nifty id') + self.assertTrue(self.my_id.text == 'my nifty id') new_id = atom.core.parse(self.my_id.ToString(), atom.data.Id) - self.assert_(self.my_id.text == new_id.text) + self.assertTrue(self.my_id.text == new_id.text) class IconTest(unittest.TestCase): @@ -356,9 +356,9 @@ def testIconToAndFromString(self): self.icon.text = 'my picture' - self.assert_(self.icon.text == 'my picture') + self.assertTrue(self.icon.text == 'my picture') new_icon = atom.core.parse(str(self.icon), atom.data.Icon) - self.assert_(self.icon.text == new_icon.text) + self.assertTrue(self.icon.text == new_icon.text) class LogoTest(unittest.TestCase): @@ -368,9 +368,9 @@ def testLogoToAndFromString(self): self.logo.text = 'my logo' - self.assert_(self.logo.text == 'my logo') + self.assertTrue(self.logo.text == 'my logo') new_logo = atom.core.parse(self.logo.ToString(), atom.data.Logo) - self.assert_(self.logo.text == new_logo.text) + self.assertTrue(self.logo.text == new_logo.text) class RightsTest(unittest.TestCase): @@ -381,11 +381,11 @@ def testContributorToAndFromString(self): self.rights.text = 'you have the right to remain silent' self.rights.type = 'text' - self.assert_(self.rights.text == 'you have the right to remain silent') - self.assert_(self.rights.type == 'text') + self.assertTrue(self.rights.text == 'you have the right to remain silent') + self.assertTrue(self.rights.type == 'text') new_rights = atom.core.parse(self.rights.ToString(), atom.data.Rights) - self.assert_(self.rights.text == new_rights.text) - self.assert_(self.rights.type == new_rights.type) + self.assertTrue(self.rights.text == new_rights.text) + self.assertTrue(self.rights.type == new_rights.type) class UpdatedTest(unittest.TestCase): @@ -395,9 +395,9 @@ def testUpdatedToAndFromString(self): self.updated.text = 'my time' - self.assert_(self.updated.text == 'my time') + self.assertTrue(self.updated.text == 'my time') new_updated = atom.core.parse(self.updated.ToString(), atom.data.Updated) - self.assert_(self.updated.text == new_updated.text) + self.assertTrue(self.updated.text == new_updated.text) class PublishedTest(unittest.TestCase): @@ -407,10 +407,10 @@ def testPublishedToAndFromString(self): self.published.text = 'pub time' - self.assert_(self.published.text == 'pub time') + self.assertTrue(self.published.text == 'pub time') new_published = atom.core.parse(self.published.ToString(), atom.data.Published) - self.assert_(self.published.text == new_published.text) + self.assertTrue(self.published.text == new_published.text) class FeedEntryParentTest(unittest.TestCase): @@ -423,16 +423,16 @@ original.author.append(atom.data.Author(name=atom.data.Name( text='J Scud'))) - self.assert_(original.author[0].name.text == 'J Scud') - self.assert_(copy.author == []) + self.assertTrue(original.author[0].name.text == 'J Scud') + self.assertTrue(copy.author == []) original.id = atom.data.Id(text='test id') - self.assert_(original.id.text == 'test id') - self.assert_(copy.id is None) + self.assertTrue(original.id.text == 'test id') + self.assertTrue(copy.id is None) copy._harvest_tree(original._to_tree()) - self.assert_(original.author[0].name.text == copy.author[0].name.text) - self.assert_(original.id.text == copy.id.text) + self.assertTrue(original.author[0].name.text == copy.author[0].name.text) + self.assertTrue(original.id.text == copy.id.text) class EntryTest(unittest.TestCase): @@ -441,21 +441,21 @@ entry = atom.data.Entry() entry.author.append(atom.data.Author(name=atom.data.Name(text='js'))) entry.title = atom.data.Title(text='my test entry') - self.assert_(entry.author[0].name.text == 'js') - self.assert_(entry.title.text == 'my test entry') + self.assertTrue(entry.author[0].name.text == 'js') + self.assertTrue(entry.title.text == 'my test entry') new_entry = atom.core.parse(entry.ToString(), atom.data.Entry) - self.assert_(new_entry.author[0].name.text == 'js') - self.assert_(new_entry.title.text == 'my test entry') + self.assertTrue(new_entry.author[0].name.text == 'js') + self.assertTrue(new_entry.title.text == 'my test entry') def testEntryCorrectlyConvertsActualData(self): entry = atom.core.parse(XML_ENTRY_1, atom.data.Entry) - self.assert_(entry.category[0].scheme == + self.assertTrue(entry.category[0].scheme == 'http://base.google.com/categories/itemtypes') - self.assert_(entry.category[0].term == 'products') - self.assert_(entry.id.text == ' http://www.google.com/test/id/url ') - self.assert_(entry.title.text == 'Testing 2000 series laptop') - self.assert_(entry.title.type == 'text') - self.assert_(entry.content.type == 'xhtml') + self.assertTrue(entry.category[0].term == 'products') + self.assertTrue(entry.id.text == ' http://www.google.com/test/id/url ') + self.assertTrue(entry.title.text == 'Testing 2000 series laptop') + self.assertTrue(entry.title.type == 'text') + self.assertTrue(entry.content.type == 'xhtml') #TODO check all other values for the test entry def testEntryWithFindElementAndFindAttribute(self): @@ -500,9 +500,9 @@ products """ entry = atom.core.parse(TEST_BASE_ENTRY, atom.data.Entry) - self.assertEquals(entry.control.draft.text, 'yes') - self.assertEquals(len(entry.control.extension_elements), 1) - self.assertEquals(entry.control.extension_elements[0].tag, 'disapproved') + self.assertEqual(entry.control.draft.text, 'yes') + self.assertEqual(len(entry.control.extension_elements), 1) + self.assertEqual(entry.control.extension_elements[0].tag, 'disapproved') class ControlTest(unittest.TestCase): @@ -521,23 +521,23 @@ no""" control_v1 = atom.core.parse(xml_v1, atom.data.Control, 1) control_v2 = atom.core.parse(xml_v2, atom.data.Control, 2) - self.assert_(control_v1 is not None) - self.assert_(control_v2 is not None) + self.assertTrue(control_v1 is not None) + self.assertTrue(control_v2 is not None) # Parsing with mismatched version numbers should return None. - self.assert_(atom.core.parse(xml_v1, atom.data.Control, 2) is None) - self.assert_(atom.core.parse(xml_v2, atom.data.Control, 1) is None) + self.assertTrue(atom.core.parse(xml_v1, atom.data.Control, 2) is None) + self.assertTrue(atom.core.parse(xml_v2, atom.data.Control, 1) is None) def testConvertToAndFromString(self): control = atom.data.Control() control.text = 'some text' control.draft = atom.data.Draft(text='yes') - self.assertEquals(control.draft.text, 'yes') - self.assertEquals(control.text, 'some text') - self.assert_(isinstance(control.draft, atom.data.Draft)) + self.assertEqual(control.draft.text, 'yes') + self.assertEqual(control.text, 'some text') + self.assertTrue(isinstance(control.draft, atom.data.Draft)) new_control = atom.core.parse(str(control), atom.data.Control) - self.assertEquals(control.draft.text, new_control.draft.text) - self.assertEquals(control.text, new_control.text) - self.assert_(isinstance(new_control.draft, atom.data.Draft)) + self.assertEqual(control.draft.text, new_control.draft.text) + self.assertEqual(control.text, new_control.text) + self.assertTrue(isinstance(new_control.draft, atom.data.Draft)) class DraftTest(unittest.TestCase): @@ -546,11 +546,11 @@ draft = atom.data.Draft() draft.text = 'maybe' draft.extension_attributes['foo'] = 'bar' - self.assertEquals(draft.text, 'maybe') - self.assertEquals(draft.extension_attributes['foo'], 'bar') + self.assertEqual(draft.text, 'maybe') + self.assertEqual(draft.extension_attributes['foo'], 'bar') new_draft = atom.core.parse(str(draft), atom.data.Draft) - self.assertEquals(draft.text, new_draft.text) - self.assertEquals(draft.extension_attributes['foo'], + self.assertEqual(draft.text, new_draft.text) + self.assertEqual(draft.extension_attributes['foo'], new_draft.extension_attributes['foo']) @@ -562,13 +562,13 @@ source.author.append(atom.data.Author(name=atom.data.Name(text='js'))) source.title = atom.data.Title(text='my test source') source.generator = atom.data.Generator(text='gen') - self.assert_(source.author[0].name.text == 'js') - self.assert_(source.title.text == 'my test source') - self.assert_(source.generator.text == 'gen') + self.assertTrue(source.author[0].name.text == 'js') + self.assertTrue(source.title.text == 'my test source') + self.assertTrue(source.generator.text == 'gen') new_source = atom.core.parse(source.ToString(), atom.data.Source) - self.assert_(new_source.author[0].name.text == 'js') - self.assert_(new_source.title.text == 'my test source') - self.assert_(new_source.generator.text == 'gen') + self.assertTrue(new_source.author[0].name.text == 'js') + self.assertTrue(new_source.title.text == 'my test source') + self.assertTrue(new_source.generator.text == 'gen') class FeedTest(unittest.TestCase): @@ -580,15 +580,15 @@ feed.generator = atom.data.Generator(text='gen') feed.entry.append(atom.data.Entry(author=[atom.data.Author( name=atom.data.Name(text='entry author'))])) - self.assert_(feed.author[0].name.text == 'js') - self.assert_(feed.title.text == 'my test source') - self.assert_(feed.generator.text == 'gen') - self.assert_(feed.entry[0].author[0].name.text == 'entry author') + self.assertTrue(feed.author[0].name.text == 'js') + self.assertTrue(feed.title.text == 'my test source') + self.assertTrue(feed.generator.text == 'gen') + self.assertTrue(feed.entry[0].author[0].name.text == 'entry author') new_feed = atom.core.parse(feed.ToString(), atom.data.Feed) - self.assert_(new_feed.author[0].name.text == 'js') - self.assert_(new_feed.title.text == 'my test source') - self.assert_(new_feed.generator.text == 'gen') - self.assert_(new_feed.entry[0].author[0].name.text == 'entry author') + self.assertTrue(new_feed.author[0].name.text == 'js') + self.assertTrue(new_feed.title.text == 'my test source') + self.assertTrue(new_feed.generator.text == 'gen') + self.assertTrue(new_feed.entry[0].author[0].name.text == 'entry author') def testPreserveEntryOrder(self): test_xml = ( @@ -608,18 +608,18 @@ '9' '') feed = atom.core.parse(test_xml, atom.data.Feed) - for i in xrange(10): + for i in range(10): self.assertEqual(feed.entry[i].id.text, str(i)) feed = atom.core.parse(feed.ToString(), atom.data.Feed) - for i in xrange(10): + for i in range(10): self.assertEqual(feed.entry[i].id.text, str(i)) temp = feed.entry[3] feed.entry[3] = feed.entry[4] feed.entry[4] = temp - self.assert_(feed.entry[2].id.text == '2') - self.assert_(feed.entry[3].id.text == '4') - self.assert_(feed.entry[4].id.text == '3') - self.assert_(feed.entry[5].id.text == '5') + self.assertTrue(feed.entry[2].id.text == '2') + self.assertTrue(feed.entry[3].id.text == '4') + self.assertTrue(feed.entry[4].id.text == '3') + self.assertTrue(feed.entry[5].id.text == '5') feed = atom.core.parse(feed.to_string(), atom.data.Feed) self.assertEqual(feed.entry[2].id.text, '2') self.assertEqual(feed.entry[3].id.text, '4') @@ -637,22 +637,22 @@ self.content.text = 'my content' self.content.type = 'text' self.content.src = 'my source' - self.assert_(self.content.text == 'my content') - self.assert_(self.content.type == 'text') - self.assert_(self.content.src == 'my source') + self.assertTrue(self.content.text == 'my content') + self.assertTrue(self.content.type == 'text') + self.assertTrue(self.content.src == 'my source') new_content = atom.core.parse(self.content.ToString(), atom.data.Content) - self.assert_(self.content.text == new_content.text) - self.assert_(self.content.type == new_content.type) - self.assert_(self.content.src == new_content.src) + self.assertTrue(self.content.text == new_content.text) + self.assertTrue(self.content.type == new_content.type) + self.assertTrue(self.content.src == new_content.src) def testContentConstructorSetsSrc(self): new_content = atom.data.Content(src='abcd') - self.assertEquals(new_content.src, 'abcd') + self.assertEqual(new_content.src, 'abcd') def testContentFromString(self): content_xml = '' content = atom.core.parse(content_xml, atom.data.Content) - self.assert_(isinstance(content, atom.data.Content)) + self.assertTrue(isinstance(content, atom.data.Content)) self.assertEqual(content.type, 'test') @@ -704,32 +704,32 @@ atom.data.Feed) def testCaptureOpenSearchElements(self): - self.assertEquals(self.feed.FindExtensions('totalResults')[0].tag, + self.assertEqual(self.feed.FindExtensions('totalResults')[0].tag, 'totalResults') - self.assertEquals(self.feed.FindExtensions('totalResults')[0].namespace, + self.assertEqual(self.feed.FindExtensions('totalResults')[0].namespace, 'http://a9.com/-/spec/opensearchrss/1.0/') open_search_extensions = self.feed.FindExtensions( namespace='http://a9.com/-/spec/opensearchrss/1.0/') - self.assertEquals(len(open_search_extensions), 3) + self.assertEqual(len(open_search_extensions), 3) for element in open_search_extensions: - self.assertEquals(element.namespace, + self.assertEqual(element.namespace, 'http://a9.com/-/spec/opensearchrss/1.0/') def testCaptureMetaElements(self): meta_elements = self.feed.entry[0].FindExtensions( namespace='http://base.google.com/ns-metadata/1.0') - self.assertEquals(len(meta_elements), 1) - self.assertEquals(meta_elements[0].attributes['count'], '4416629') - self.assertEquals(len(meta_elements[0].children), 10) + self.assertEqual(len(meta_elements), 1) + self.assertEqual(meta_elements[0].attributes['count'], '4416629') + self.assertEqual(len(meta_elements[0].children), 10) def testCaptureMetaChildElements(self): meta_elements = self.feed.entry[0].FindExtensions( namespace='http://base.google.com/ns-metadata/1.0') meta_children = meta_elements[0].FindChildren( namespace='http://base.google.com/ns-metadata/1.0') - self.assertEquals(len(meta_children), 10) + self.assertEqual(len(meta_children), 10) for child in meta_children: - self.assertEquals(child.tag, 'value') + self.assertEqual(child.tag, 'value') class LinkFinderTest(unittest.TestCase): @@ -738,24 +738,24 @@ self.entry = atom.core.parse(XML_ENTRY_1, atom.data.Entry) def testLinkFinderGetsLicenseLink(self): - self.assert_(isinstance(self.entry.GetLink('license'), atom.data.Link)) - self.assert_(isinstance(self.entry.GetLicenseLink(), atom.data.Link)) - self.assertEquals(self.entry.GetLink('license').href, + self.assertTrue(isinstance(self.entry.GetLink('license'), atom.data.Link)) + self.assertTrue(isinstance(self.entry.GetLicenseLink(), atom.data.Link)) + self.assertEqual(self.entry.GetLink('license').href, 'http://creativecommons.org/licenses/by-nc/2.5/rdf') - self.assertEquals(self.entry.get_license_link().href, + self.assertEqual(self.entry.get_license_link().href, 'http://creativecommons.org/licenses/by-nc/2.5/rdf') - self.assertEquals(self.entry.GetLink('license').rel, 'license') - self.assertEquals(self.entry.FindLicenseLink(), + self.assertEqual(self.entry.GetLink('license').rel, 'license') + self.assertEqual(self.entry.FindLicenseLink(), 'http://creativecommons.org/licenses/by-nc/2.5/rdf') def testLinkFinderGetsAlternateLink(self): - self.assert_(isinstance(self.entry.GetLink('alternate'), + self.assertTrue(isinstance(self.entry.GetLink('alternate'), atom.data.Link)) - self.assertEquals(self.entry.GetLink('alternate').href, + self.assertEqual(self.entry.GetLink('alternate').href, 'http://www.provider-host.com/123456789') - self.assertEquals(self.entry.FindAlternateLink(), + self.assertEqual(self.entry.FindAlternateLink(), 'http://www.provider-host.com/123456789') - self.assertEquals(self.entry.GetLink('alternate').rel, 'alternate') + self.assertEqual(self.entry.GetLink('alternate').rel, 'alternate') class AtomBaseTest(unittest.TestCase): @@ -769,21 +769,21 @@ namespace='http://ns0.com') extension_child.children.append(extension_grandchild) atom_base.extension_elements.append(extension_child) - self.assertEquals(len(atom_base.extension_elements), 1) - self.assertEquals(len(atom_base.extension_elements[0].children), 1) - self.assertEquals(atom_base.extension_elements[0].tag, 'foo') - self.assertEquals(atom_base.extension_elements[0].children[0].tag, 'bar') + self.assertEqual(len(atom_base.extension_elements), 1) + self.assertEqual(len(atom_base.extension_elements[0].children), 1) + self.assertEqual(atom_base.extension_elements[0].tag, 'foo') + self.assertEqual(atom_base.extension_elements[0].children[0].tag, 'bar') element_tree = atom_base._to_tree() - self.assert_(element_tree.find('{http://ns0.com}foo') is not None) - self.assert_(element_tree.find('{http://ns0.com}foo').find( + self.assertTrue(element_tree.find('{http://ns0.com}foo') is not None) + self.assertTrue(element_tree.find('{http://ns0.com}foo').find( '{http://ns0.com}bar') is not None) class UtfParsingTest(unittest.TestCase): def setUp(self): - self.test_xml = u""" + self.test_xml = """ http://www.google.com/test/id/url αλφα @@ -791,41 +791,41 @@ def testMemberStringEncoding(self): atom_entry = atom.core.parse(selRefactoringTool: Refactored ./tests/atom_tests/core_test.py f.test_xml, atom.data.Entry) - self.assert_(isinstance(atom_entry.title.type, unicode)) - self.assertEqual(atom_entry.title.type, u'\u03B1\u03BB\u03C6\u03B1') - self.assertEqual(atom_entry.title.text, u'\u03B1\u03BB\u03C6\u03B1') + self.assertTrue(isinstance(atom_entry.title.type, str)) + self.assertEqual(atom_entry.title.type, '\u03B1\u03BB\u03C6\u03B1') + self.assertEqual(atom_entry.title.text, '\u03B1\u03BB\u03C6\u03B1') # Setting object members to unicode strings is supported. - atom_entry.title.type = u'\u03B1\u03BB\u03C6\u03B1' + atom_entry.title.type = '\u03B1\u03BB\u03C6\u03B1' xml = atom_entry.ToString() # The unicode code points should be converted to XML escaped sequences. - self.assert_('αλφα' in xml) + self.assertTrue('αλφα' in xml) # Make sure that we can use plain text when MEMBER_STRING_ENCODING is utf8 atom_entry.title.type = "plain text" atom_entry.title.text = "more text" xml = atom_entry.ToString() - self.assert_("plain text" in xml) - self.assert_("more text" in xml) + self.assertTrue("plain text" in xml) + self.assertTrue("more text" in xml) # Test something else than utf-8 atom.core.STRING_ENCODING = 'iso8859_7' atom_entry = atom.core.parse(self.test_xml, atom.data.Entry) - self.assert_(atom_entry.title.type == u'\u03B1\u03BB\u03C6\u03B1') - self.assert_(atom_entry.title.text == u'\u03B1\u03BB\u03C6\u03B1') + self.assertTrue(atom_entry.title.type == '\u03B1\u03BB\u03C6\u03B1') + self.assertTrue(atom_entry.title.text == '\u03B1\u03BB\u03C6\u03B1') # Test using unicode strings directly for object members atom_entry = atom.core.parse(self.test_xml, atom.data.Entry) - self.assert_(atom_entry.title.type == u'\u03B1\u03BB\u03C6\u03B1') - self.assert_(atom_entry.title.text == u'\u03B1\u03BB\u03C6\u03B1') + self.assertTrue(atom_entry.title.type == '\u03B1\u03BB\u03C6\u03B1') + self.assertTrue(atom_entry.title.text == '\u03B1\u03BB\u03C6\u03B1') # Make sure that we can use plain text when MEMBER_STRING_ENCODING is # unicode atom_entry.title.type = "plain text" atom_entry.title.text = "more text" xml = atom_entry.ToString() - self.assert_("plain text" in xml) - self.assert_("more text" in xml) + self.assertTrue("plain text" in xml) + self.assertTrue("more text" in xml) def testConvertExampleXML(self): GBASE_STRING_ENCODING_ENTRY = """ @@ -876,7 +876,7 @@ def test_monoversioned_parent_with_multiversioned_child(self): v2_rules = atom.data.Entry._get_rules(2) - self.assert_('{http://www.w3.org/2007/app}control' in v2_rules[1]) + self.assertTrue('{http://www.w3.org/2007/app}control' in v2_rules[1]) entry_xml = """ @@ -885,20 +885,20 @@ """ entry = e = atom.core.parse(entry_xml, atom.data.Entry, version=2) - self.assert_(entry is not None) - self.assert_(entry.control is not None) - self.assert_(entry.control.draft is not None) + self.assertTrue(entry is not None) + self.assertTrue(entry.control is not None) + self.assertTrue(entry.control.draft is not None) self.assertEqual(entry.control.draft.text, 'yes') # v1 rules should not parse v2 XML. entry = e = atom.core.parse(entry_xml, atom.data.Entry, version=1) - self.assert_(entry is not None) - self.assert_(entry.control is None) + self.assertTrue(entry is not None) + self.assertTrue(entry.control is None) # The default version should be v1. entry = e = atom.core.parse(entry_xml, atom.data.Entry) - self.assert_(entry is not None) - self.assert_(entry.control is None) + self.assertTrue(entry is not None) + self.assertTrue(entry.control is None) class DataModelSanityTest(unittest.TestCase): --- ./tests/atom_tests/core_test.py (original) +++ ./tests/atom_tests/core_test.py (refactored) @@ -103,40 +103,40 @@ class Versioned(atom.core.XmlElement): _qname = ('{http://example.com/1}foo', '{http://example.com/2}foo') - self.assert_( + self.assertTrue( atom.core._get_qname(Unversioned, 1) == '{http://example.com}foo') - self.assert_( + self.assertTrue( atom.core._get_qname(Unversioned, 2) == '{http://example.com}foo') - self.assert_( + self.assertTrue( atom.core._get_qname(Versioned, 1) == '{http://example.com/1}foo') - self.assert_( + self.assertTrue( atom.core._get_qname(Versioned, 2) == '{http://example.com/2}foo') def testConstructor(self): e = Example() - self.assert_(e.child is None) - self.assert_(e.tag is None) - self.assert_(e.versioned_attr is None) - self.assert_(e.foos == []) - self.assert_(e.text is None) + self.assertTrue(e.child is None) + self.assertTrue(e.tag is None) + self.assertTrue(e.versioned_attr is None) + self.assertTrue(e.foos == []) + self.assertTrue(e.text is None) def testGetRules(self): rules1 = Example._get_rules(1) - self.assert_(rules1[0] == '{http://example.com}foo') - self.assert_(rules1[1]['{http://example.com/1}child'] == ('child', Child, + self.assertTrue(rules1[0] == '{http://example.com}foo') + self.assertTrue(rules1[1]['{http://example.com/1}child'] == ('child', Child, False)) - self.assert_(rules1[1]['foo'] == ('foos', Foo, True)) - self.assert_(rules1[2]['tag'] == 'tag') - self.assert_(rules1[2]['attr'] == 'versioned_attr') + self.assertTrue(rules1[1]['foo'] == ('foos', Foo, True)) + self.assertTrue(rules1[2]['tag'] == 'tag') + self.assertTrue(rules1[2]['attr'] == 'versioned_attr') # Check to make sure we don't recalculate the rules. - self.assert_(rules1 == Example._get_rules(1)) + self.assertTrue(rules1 == Example._get_rules(1)) rules2 = Example._get_rules(2) - self.assert_(rules2[0] == '{http://example.com}foo') - self.assert_(rules2[1]['{http://example.com/2}child'] == ('child', Child, + self.assertTrue(rules2[0] == '{http://example.com}foo') + self.assertTrue(rules2[1]['{http://example.com/2}child'] == ('child', Child, False)) - self.assert_(rules2[1]['foo'] == ('foos', Foo, True)) - self.assert_(rules2[2]['tag'] == 'tag') - self.assert_(rules2[2]['{http://new_ns}attr'] == 'versioned_attr') + self.assertTrue(rules2[1]['foo'] == ('foos', Foo, True)) + self.assertTrue(rules2[2]['tag'] == 'tag') + self.assertTrue(rules2[2]['{http://new_ns}attr'] == 'versioned_attr') def testGetElements(self): e = Example() @@ -174,50 +174,50 @@ ['other1']) def contains_expected_elements(self, elements, expected_texts): - self.assert_(len(elements) == len(expected_texts)) + self.assertTrue(len(elements) == len(expected_texts)) for element in elements: - self.assert_(element.text in expected_texts) + self.assertTrue(element.text in expected_texts) def testConstructorKwargs(self): e = Example('hello', child=Child('world'), versioned_attr='1') - self.assert_(e.text == 'hello') - self.assert_(e.child.text == 'world') - self.assert_(e.versioned_attr == '1') - self.assert_(e.foos == []) - self.assert_(e.tag is None) + self.assertTrue(e.text == 'hello') + self.assertTrue(e.child.text == 'world') + self.assertTrue(e.versioned_attr == '1') + self.assertTrue(e.foos == []) + self.assertTrue(e.tag is None) e = Example(foos=[Foo('1', ignored=1), Foo(text='2')], tag='ok') - self.assert_(e.text is None) - self.assert_(e.child is None) - self.assert_(e.versioned_attr is None) - self.assert_(len(e.foos) == 2) - self.assert_(e.foos[0].text == '1') - self.assert_(e.foos[1].text == '2') - self.assert_('ignored' not in e.foos[0].__dict__) - self.assert_(e.tag == 'ok') + self.assertTrue(e.text is None) + self.assertTrue(e.child is None) + self.assertTrue(e.versioned_attr is None) + self.assertTrue(len(e.foos) == 2) + self.assertTrue(e.foos[0].text == '1') + self.assertTrue(e.foos[1].text == '2') + self.assertTrue('ignored' not in e.foos[0].__dict__) + self.assertTrue(e.tag == 'ok') def testParseBasicXmlElement(self): element = atom.core.xml_element_from_string(SAMPLE_XML, atom.core.XmlElement) inners = element.get_elements('inner') - self.assert_(len(inners) == 3) - self.assert_(inners[0].get_attributes('x')[0].value == '123') - self.assert_(inners[0].get_attributes('y') == []) - self.assert_(inners[1].get_attributes('x')[0].value == '234') - self.assert_(inners[1].get_attributes('y')[0].value == 'abc') - self.assert_(inners[2].get_attributes('x') == []) + self.assertTrue(len(inners) == 3) + self.assertTrue(inners[0].get_attributes('x')[0].value == '123') + self.assertTrue(inners[0].get_attributes('y') == []) + self.assertTrue(inners[1].get_attributes('x')[0].value == '234') + self.assertTrue(inners[1].get_attributes('y')[0].value == 'abc') + self.assertTrue(inners[2].get_attributes('x') == []) inners = element.get_elements('inner', 'http://example.com/xml/1') - self.assert_(len(inners) == 3) + self.assertTrue(len(inners) == 3) inners = element.get_elements(None, 'http://example.com/xml/1') - self.assert_(len(inners) == 4) + self.assertTrue(len(inners) == 4) inners = element.get_elements() - self.assert_(len(inners) == 4) + self.assertTrue(len(inners) == 4) inners = element.get_elements('other') - self.assert_(len(inners) == 1) - self.assert_(inners[0].get_attributes( + self.assertTrue(len(inners) == 1) + self.assertTrue(inners[0].get_attributes( 'z', 'http://example.com/xml/2')[0].value == 'true') inners = element.get_elements('missing') - self.assert_(len(inners) == 0) + self.assertTrue(len(inners) == 0) def testBasicXmlElementPreservesMarkup(self): element = atom.core.xml_element_from_string(SAMPLE_XML, @@ -228,9 +228,9 @@ def testSchemaParse(self): outer = atom.core.xml_element_from_string(SAMPLE_XML, Outer) - self.assert_(isinstance(outer.innards, list)) - self.assert_(len(outer.innards) == 3) - self.assert_(outer.innards[0].my_x == '123') + self.assertTrue(isinstance(outer.innards, list)) + self.assertTrue(len(outer.innards) == 3) + self.assertTrue(outer.innards[0].my_x == '123') def testSchemaParsePreservesMarkup(self): outer = atom.core.xml_element_from_string(SAMPLE_XML, Outer) @@ -245,82 +245,82 @@ if 'y' in match.attrib and match.attrib['y'] == 'abc': if match.attrib['x'] == '234': found_x_and_y = True - self.assert_(match.attrib['x'] == '234') + self.assertTrue(match.attrib['x'] == '234') if 'x' in match.attrib and match.attrib['x'] == '123': - self.assert_('y' not in match.attrib) + self.assertTrue('y' not in match.attrib) found_x_123 = True - self.assert_(found_x_and_y) - self.assert_(found_x_123) + self.assertTrue(found_x_and_y) + self.assertTrue(found_x_123) def testGenericTagAndNamespace(self): element = atom.core.XmlElement(text='content') # Try setting tag then namespace. element.tag = 'foo' - self.assert_(element._qname == 'foo') + self.assertTrue(element._qname == 'foo') element.namespace = 'http://example.com/ns' - self.assert_(element._qname == '{http://example.com/ns}foo') + self.assertTrue(element._qname == '{http://example.com/ns}foo') element = atom.core.XmlElement() # Try setting namespace then tag. element.namespace = 'http://example.com/ns' - self.assert_(element._qname == '{http://example.com/ns}') + self.assertTrue(element._qname == '{http://example.com/ns}') element.tag = 'foo' - self.assert_(element._qname == '{http://example.com/ns}foo') + self.assertTrue(element._qname == '{http://example.com/ns}foo') def assert_trees_similar(self, a, b): """Compares two XML trees for approximate matching.""" for child in a: - self.assert_(len(a.findall(child.tag)) == len(b.findall(child.tag))) + self.assertTrue(len(a.findall(child.tag)) == len(b.findall(child.tag))) for child in b: - self.assert_(len(a.findall(child.tag)) == len(b.findall(child.tag))) - self.assert_(len(a) == len(b)) - self.assert_(a.text == b.text) - self.assert_(a.attrib == b.attrib) + self.assertTrue(len(a.findall(child.tag)) == len(b.findall(child.tag))) + self.assertTrue(len(a) == len(b)) + self.assertTrue(a.text == b.text) + self.assertTrue(a.attrib == b.attrib) class UtilityFunctionTest(unittest.TestCase): def testMatchQnames(self): - self.assert_(atom.core._qname_matches( + self.assertTrue(atom.core._qname_matches( 'foo', 'http://example.com', '{http://example.com}foo')) - self.assert_(atom.core._qname_matches( + self.assertTrue(atom.core._qname_matches( None, None, '{http://example.com}foo')) - self.assert_(atom.core._qname_matches( + self.assertTrue(atom.core._qname_matches( None, None, 'foo')) - self.assert_(atom.core._qname_matches( + self.assertTrue(atom.core._qname_matches( None, None, None)) - self.assert_(atom.core._qname_matches( + self.assertTrue(atom.core._qname_matches( None, None, '{http://example.com}')) - self.assert_(atom.core._qname_matches( + self.assertTrue(atom.core._qname_matches( 'foo', None, '{http://example.com}foo')) - self.assert_(atom.core._qname_matches( + self.assertTrue(atom.core._qname_matches( None, 'http://example.com', '{http://example.com}foo')) - self.assert_(atom.core._qname_matches( + self.assertTrue(atom.core._qname_matches( None, '', 'foo')) - self.assert_(atom.core._qname_matches( + self.assertTrue(atom.core._qname_matches( 'foo', '', 'foo')) - self.assert_(atom.core._qname_matches( + self.assertTrue(atom.core._qname_matches( 'foo', '', 'foo')) - self.assert_(atom.core._qname_matches( + self.assertTrue(atom.core._qname_matches( 'foo', 'http://google.com', '{http://example.com}foo') == False) - self.assert_(atom.core._qname_matches( + self.assertTrue(atom.core._qname_matches( 'foo', 'http://example.com', '{http://example.com}bar') == False) - self.assert_(atom.core._qname_matches( + self.assertTrue(atom.core._qname_matches( 'foo', 'http://example.com', '{http://google.com}foo') == False) - self.assert_(atom.core._qname_matches( + self.assertTrue(atom.core._qname_matches( 'bar', 'http://example.com', '{http://google.com}foo') == False) - self.assert_(atom.core._qname_matches( + self.assertTrue(atom.core._qname_matches( 'foo', None, '{http://example.com}bar') == False) - self.assert_(atom.core._qname_matches( + self.assertTrue(atom.core._qname_matches( None, 'http://google.com', '{http://example.com}foo') == False) - self.assert_(atom.core._qname_matches( + self.assertTrue(atom.core._qname_matches( None, '', '{http://example.com}foo') == False) - self.assert_(atom.core._qname_matches( + self.assertTrue(atom.core._qname_matches( 'foo', '', 'bar') == False) class Chars(atom.core.XmlElement): - _qname = u'{http://example.com/}chars' + _qname = '{http://example.com/}chars' y = 'y' alpha = 'a' @@ -328,7 +328,7 @@ class Strs(atom.core.XmlElement): _qname = '{http://example.com/}strs' chars = [Chars] - delta = u'd' + delta = 'd' def parse(string): @@ -345,45 +345,45 @@ def testUnicodeInputString(self): # Test parsing the inner text. - self.assertEqual(parse(u'δ').text, u'\u03b4') - self.assertEqual(parse(u'\u03b4').text, u'\u03b4') + self.assertEqual(parse('δ').text, '\u03b4') + self.assertEqual(parse('\u03b4').text, '\u03b4') # Test output valid XML. - self.assertEqual(parse(u'δ').to_string(), 'δ') - self.assertEqual(parse(u'\u03b4').to_string(), 'δ') + self.assertEqual(parse('δ').to_string(), 'δ') + self.assertEqual(parse('\u03b4').to_string(), 'δ') # Test setting the inner text and output valid XML. - e = create(u'x', u'\u03b4') + e = create('x', '\u03b4') self.assertEqual(e.to_string(), 'δ') - self.assertEqual(e.text, u'\u03b4') - self.assert_(isinstance(e.text, unicode)) - self.assertEqual(create(u'x', '\xce\xb4'.decode('utf-8')).to_string(), + self.assertEqual(e.text, '\u03b4') + self.assertTrue(isinstance(e.text, str)) + self.assertEqual(create('x', '\xce\xb4'.decode('utf-8')).to_string(), 'δ') def testUnicodeTagsAndAttributes(self): # Begin with test to show underlying ElementTree behavior. - t = ElementTree.fromstring(u'test'.encode('utf-8')) - self.assertEqual(t.tag, u'del\u03b4ta') - self.assertEqual(parse(u'<\u03b4elta>test')._qname, - u'\u03b4elta') + t = ElementTree.fromstring('test'.encode('utf-8')) + self.assertEqual(t.tag, 'del\u03b4ta') + self.assertEqual(parse('<\u03b4elta>test')._qname, + '\u03b4elta') # Test unicode attribute names and values. - t = ElementTree.fromstring(u''.encode('utf-8')) - self.assertEqual(t.attrib, {u'\u03b4a': u'\u03b4b'}) - self.assertEqual(parse(u'').get_attributes( - u'\u03b4a')[0].value, u'\u03b4b') + t = ElementTree.fromstring(''.encode('utf-8')) + self.assertEqual(t.attrib, {'\u03b4a': '\u03b4b'}) + self.assertEqual(parse('').get_attributes( + '\u03b4a')[0].value, '\u03b4b') x = create('x', None) - x._other_attributes[u'a'] = u'\u03b4elta' - self.assert_(x.to_string().startswith('δ').text, u'\u03b4') - self.assertEqual(parse(u'\u03b4'.encode('utf-8')).text, u'\u03b4') - self.assertEqual(parse('\xce\xb4').text, u'\u03b4') + self.assertEqual(parse('δ').text, '\u03b4') + self.assertEqual(parse('\u03b4'.encode('utf-8')).text, '\u03b4') + self.assertEqual(parse('\xce\xb4').text, '\u03b4') # Test output valid XML. self.assertEqual(parse('δ').to_string(), 'δ') - self.assertEqual(parse(u'\u03b4'.encode('utf-8')).to_string(), + self.assertEqual(parse('\u03b4'.encode('utf-8')).to_string(), 'δ') self.assertEqual(parse('\xce\xb4').to_string(), 'δ') @@ -392,47 +392,47 @@ self.assertEqual(e.to_string(), 'δ') # Don't change the encoding until the we convert to an XML string. self.assertEqual(e.text, '\xce\xb4') - self.assert_(isinstance(e.text, str)) - self.assert_(isinstance(e.to_string(), str)) - self.assertEqual(create('x', u'\u03b4'.encode('utf-8')).to_string(), + self.assertTrue(isinstance(e.text, str)) + self.assertTrue(isinstance(e.to_string(), str)) + self.assertEqual(create('x', '\u03b4'.encode('utf-8')).to_string(), 'δ') # Test attributes and values with UTF-8 inputs. self.assertEqual(parse('').get_attributes( - u'\u03b4a')[0].value, u'\u03b4b') + '\u03b4a')[0].value, '\u03b4b') def testUtf8TagsAndAttributes(self): self.assertEqual( - parse(u'<\u03b4elta>test'.encode('utf-8'))._qname, - u'\u03b4elta') + parse('<\u03b4elta>test'.encode('utf-8'))._qname, + '\u03b4elta') self.assertEqual(parse('<\xce\xb4elta>test')._qname, - u'\u03b4elta') + '\u03b4elta') # Test an element with UTF-8 in the attribute vaRefactoringTool: Refactored ./tests/atom_tests/client_test.py lue. x = create('x', None) - x._other_attributes[u'a'] = '\xce\xb4' - self.assert_(x.to_string(encoding='UTF-8').startswith('\u03b4'.encode('utf-16')).text, u'\u03b4') + self.assertEqual(parse('\u03b4'.encode('utf-16')).text, '\u03b4') # Test output valid XML. - self.assertEqual(parse(u'\u03b4'.encode('utf-16')).to_string(), + self.assertEqual(parse('\u03b4'.encode('utf-16')).to_string(), 'δ') # Test setting the inner text and output valid XML. - e = create('x', u'\u03b4'.encode('utf-16')) + e = create('x', '\u03b4'.encode('utf-16')) self.assertEqual(e.to_string(encoding='utf-16'), 'δ') # Don't change the encoding until the we convert to an XML string. # Allow either little-endian or big-endian byte orderings. - self.assert_(e.text in ['\xff\xfe\xb4\x03', '\xfe\xff\x03\xb4']) + self.assertTrue(e.text in ['\xff\xfe\xb4\x03', '\xfe\xff\x03\xb4']) endianness = LITTLE_ENDIAN if e.text == '\xfe\xff\x03\xb4': endianness = BIG_ENDIAN - self.assert_(isinstance(e.text, str)) - self.assert_(isinstance(e.to_string(encoding='utf-16'), str)) + self.assertTrue(isinstance(e.text, str)) + self.assertTrue(isinstance(e.to_string(encoding='utf-16'), str)) if endianness == LITTLE_ENDIAN: self.assertEqual( create('x', '\xff\xfe\xb4\x03').to_string(encoding='utf-16'), @@ -444,12 +444,12 @@ def testOtherEncodingInTagsAndAttributes(self): self.assertEqual( - parse(u'<\u03b4elta>test'.encode('utf-16'))._qname, - u'\u03b4elta') + parse('<\u03b4elta>test'.encode('utf-16'))._qname, + '\u03b4elta') # Test an element with UTF-16 in the attribute value. x = create('x', None) - x._other_attributes[u'a'] = u'\u03b4'.encode('utf-16') - self.assert_(x.to_string(encoding='UTF-16').startswith('9' '') feed = atom.FeedFromString(test_xml) - for i in xrange(10): - self.assert_(feed.entry[i].id.text == str(i)) + for i in range(10): + self.assertTrue(feed.entry[i].id.text == str(i)) feed = atom.FeedFromString(feed.ToString()) - for i in xrange(10): - self.assert_(feed.entry[i].id.text == str(i)) + for i in range(10): + self.assertTrue(feed.entry[i].id.text == str(i)) temp = feed.entry[3] feed.entry[3] = feed.entry[4] feed.entry[4] = temp - self.assert_(feed.entry[2].id.text == '2') - self.assert_(feed.entry[3].id.text == '4') - self.assert_(feed.entry[4].id.text == '3') - self.assert_(feed.entry[5].id.text == '5') + self.assertTrue(feed.entry[2].id.text == '2') + self.assertTrue(feed.entry[3].id.text == '4') + self.assertTrue(feed.entry[4].id.text == '3') + self.assertTrue(feed.entry[5].id.text == '5') feed = atom.FeedFromString(feed.ToString()) - self.assert_(feed.entry[2].id.text == '2') - self.assert_(feed.entry[3].id.text == '4') - self.assert_(feed.entry[4].id.text == '3') - self.assert_(feed.entry[5].id.text == '5') + self.assertTrue(feed.entry[2].id.text == '2') + self.assertTrue(feed.entry[3].id.text == '4') + self.assertTrue(feed.entry[4].id.text == '3') + self.assertTrue(feed.entry[5].id.text == '5') class ContentEntryParentTest(unittest.TestCase): @@ -527,17 +527,17 @@ self.content.text = 'my content' self.content.type = 'text' self.content.src = 'my source' - self.assert_(self.content.text == 'my content') - self.assert_(self.content.type == 'text') - self.assert_(self.content.src == 'my source') + self.assertTrue(self.content.text == 'my content') + self.assertTrue(self.content.type == 'text') + self.assertTrue(self.content.src == 'my source') new_content = atom.ContentFromString(self.content.ToString()) - self.assert_(self.content.text == new_content.text) - self.assert_(self.content.type == new_content.type) - self.assert_(self.content.src == new_content.src) + self.assertTrue(self.content.text == new_content.text) + self.assertTrue(self.content.type == new_content.type) + self.assertTrue(self.content.src == new_content.src) def testContentConstructorSetsSrc(self): new_content = atom.Content(src='abcd') - self.assertEquals(new_content.src, 'abcd') + self.assertEqual(new_content.src, 'abcd') class PreserveUnkownElementTest(unittest.TestCase): @@ -547,32 +547,32 @@ self.feed = atom.FeedFromString(test_data.GBASE_ATTRIBUTE_FEED) def testCaptureOpenSearchElements(self): - self.assertEquals(self.feed.FindExtensions('totalResults')[0].tag, + self.assertEqual(self.feed.FindExtensions('totalResults')[0].tag, 'totalResults') - self.assertEquals(self.feed.FindExtensions('totalResults')[0].namespace, + self.assertEqual(self.feed.FindExtensions('totalResults')[0].namespace, 'http://a9.com/-/spec/opensearchrss/1.0/') open_search_extensions = self.feed.FindExtensions( namespace='http://a9.com/-/spec/opensearchrss/1.0/') - self.assertEquals(len(open_search_extensions), 3) + self.assertEqual(len(open_search_extensions), 3) for element in open_search_extensions: - self.assertEquals(element.namespace, + self.assertEqual(element.namespace, 'http://a9.com/-/spec/opensearchrss/1.0/') def testCaptureMetaElements(self): meta_elements = self.feed.entry[0].FindExtensions( namespace='http://base.google.com/ns-metadata/1.0') - self.assertEquals(len(meta_elements), 1) - self.assertEquals(meta_elements[0].attributes['count'], '4416629') - self.assertEquals(len(meta_elements[0].children), 10) + self.assertEqual(len(meta_elements), 1) + self.assertEqual(meta_elements[0].attributes['count'], '4416629') + self.assertEqual(len(meta_elements[0].children), 10) def testCaptureMetaChildElements(self): meta_elements = self.feed.entry[0].FindExtensions( namespace='http://base.google.com/ns-metadata/1.0') meta_children = meta_elements[0].FindChildren( namespace='http://base.google.com/ns-metadata/1.0') - self.assertEquals(len(meta_children), 10) + self.assertEqual(len(meta_children), 10) for child in meta_children: - self.assertEquals(child.tag, 'value') + self.assertEqual(child.tag, 'value') class LinkFinderTest(unittest.TestCase): @@ -581,18 +581,18 @@ self.entry = atom.EntryFromString(test_data.XML_ENTRY_1) def testLinkFinderGetsLicenseLink(self): - self.assertEquals(isinstance(self.entry.GetLicenseLink(), atom.Link), + self.assertEqual(isinstance(self.entry.GetLicenseLink(), atom.Link), True) - self.assertEquals(self.entry.GetLicenseLink().href, + self.assertEqual(self.entry.GetLicenseLink().href, 'http://creativecommons.org/licenses/by-nc/2.5/rdf') - self.assertEquals(self.entry.GetLicenseLink().rel, 'license') + self.assertEqual(self.entry.GetLicenseLink().rel, 'license') def testLinkFinderGetsAlternateLink(self): - self.assertEquals(isinstance(self.entry.GetAlternateLink(), atom.Link), + self.assertEqual(isinstance(self.entry.GetAlternateLink(), atom.Link), True) - self.assertEquals(self.entry.GetAlternateLink().href, + self.assertEqual(self.entry.GetAlternateLink().href, 'http://www.provider-host.com/123456789') - self.assertEquals(self.entry.GetAlternateLink().rel, 'alternate') + self.assertEqual(self.entry.GetAlternateLink().rel, 'alternate') class AtomBaseTest(unittest.TestCase): @@ -605,21 +605,21 @@ namespace='http://ns0.com') extension_child.children.append(extension_grandchild) atom_base.extension_elements.append(extension_child) - self.assertEquals(len(atom_base.extension_elements), 1) - self.assertEquals(len(atom_base.extension_elements[0].children), 1) - self.assertEquals(atom_base.extension_elements[0].tag, 'foo') - self.assertEquals(atom_base.extension_elements[0].children[0].tag, 'bar') + self.assertEqual(len(atom_base.extension_elements), 1) + self.assertEqual(len(atom_base.extension_elements[0].children), 1) + self.assertEqual(atom_base.extension_elements[0].tag, 'foo') + self.assertEqual(atom_base.extension_elements[0].children[0].tag, 'bar') element_tree = atom_base._ToElementTree() - self.assert_(element_tree.find('{http://ns0.com}foo') is not None) - self.assert_(element_tree.find('{http://ns0.com}foo').find( + self.assertTrue(element_tree.find('{http://ns0.com}foo') is not None) + self.assertTrue(element_tree.find('{http://ns0.com}foo').find( '{http://ns0.com}bar') is not None) class UtfParsingTest(unittest.TestCase): def setUp(self): - self.test_xml = u""" + self.test_xml = """ http://www.google.com/test/id/url \u03B1\u03BB\u03C6\u03B1 @@ -634,38 +634,38 @@ # Setting object members to unicode strings is supported even if # MEMBER_STRING_ENCODING is set 'utf-8' (should it be?) - atom_entry.title.type = u'\u03B1\u03BB\u03C6\u03B1' + atom_entry.title.type = '\u03B1\u03BB\u03C6\u03B1' xml = atom_entry.ToString() - self.assert_(u'\u03B1\u03BB\u03C6\u03B1'.encode('utf-8') in xml) + self.assertTrue('\u03B1\u03BB\u03C6\u03B1'.encode('utf-8') in xml) # Make sure that we can use plain text when MEMBER_STRING_ENCODING is utf8 atom_entry.title.type = "plain text" atom_entry.title.text = "more text" xml = atom_entry.ToString() - self.assert_("plain text" in xml) - self.assert_("more text" in xml) + self.assertTrue("plain text" in xml) + self.assertTrue("more text" in xml) # Test something else than utf-8 atom.MEMBER_STRING_ENCODING = 'iso8859_7' atom_entry = atom.EntryFromString(self.test_xml) - self.assert_(atom_entry.title.type == u'\u03B1\u03BB\u03C6\u03B1'.encode( + self.assertTrue(atom_entry.title.type == '\u03B1\u03BB\u03C6\u03B1'.encode( 'iso8859_7')) - self.assert_(atom_entry.title.text == u'\u03B1\u03BB\u03C6\u03B1'.encode( + self.assertTrue(atom_entry.title.text == '\u03B1\u03BB\u03C6\u03B1'.encode( 'iso8859_7')) # Test using unicode strings directly for object members - atom.MEMBER_STRING_ENCODING = unicode + atom.MEMBER_STRING_ENCODING = str atom_entry = atom.EntryFromString(self.test_xml) - self.assert_(atom_entry.title.type == u'\u03B1\u03BB\u03C6\u03B1') - self.assert_(atom_entry.title.text == u'\u03B1\u03BB\u03C6\u03B1') + self.assertTrue(atom_entry.title.type == '\u03B1\u03BB\u03C6\u03B1') + self.assertTrue(atom_entry.title.text == '\u03B1\u03BB\u03C6\u03B1') # Make sure that we can use plain text when MEMBER_STRING_ENCODING is # unicode atom_entry.title.type = "plain text" atom_entry.title.text = "more text" xml = atom_entry.ToString() - self.assert_("plain text" in xml) - self.assert_("more text" in xml) + self.assertTrue("plain text" in xml) + self.assertTrue("more text" in xml) def testConvertExampleXML(self): try: @@ -680,17 +680,17 @@ def testDeprecationWarning(self): def to_deprecate(): return 5 - self.assertEqual(to_deprecate.func_name, 'to_deprecate') + self.assertEqual(to_deprecate.__name__, 'to_deprecate') deprecated = atom.deprecated('test')(to_deprecate) self.assertNotEqual(to_deprecate, deprecated) # After decorating a function as deprecated, the function name should # still be the name of the original function. - self.assertEqual(deprecated.func_name, 'to_deprecate') + self.assertEqual(deprecated.__name__, 'to_deprecate') #@atom.deprecated() def also_deprecated(): return 6 also_deprecated = atom.deprecated()(also_deprecated) - self.assertEqual(also_deprecated.func_name, 'also_deprecated') + self.aRefactoringTool: Refactored ./tests/all_tests_local.py RefactoringTool: Refactored ./tests/all_tests_coverage.py RefactoringTool: Refactored ./tests/all_tests_clear_cache.py RefactoringTool: Refactored ./tests/all_tests_cached.py RefactoringTool: Refactored ./tests/all_tests.py RefactoringTool: Refactored ./src/gdata/youtube/service.py ssertEqual(also_deprecated.__name__, 'also_deprecated') def suite(): --- ./tests/all_tests_local.py (original) +++ ./tests/all_tests_local.py (refactored) @@ -22,7 +22,7 @@ import unittest -import all_tests +from . import all_tests import gdata.test_config as conf --- ./tests/all_tests_coverage.py (original) +++ ./tests/all_tests_coverage.py (refactored) @@ -22,8 +22,8 @@ import unittest -import coverage -import all_tests +from . import coverage +from . import all_tests import atom.core import atom.http_core import atom.mock_http_core --- ./tests/all_tests_clear_cache.py (original) +++ ./tests/all_tests_clear_cache.py (refactored) @@ -22,7 +22,7 @@ import unittest -import all_tests +from . import all_tests from gdata.test_config import settings --- ./tests/all_tests_cached.py (original) +++ ./tests/all_tests_cached.py (refactored) @@ -22,7 +22,7 @@ import unittest -import all_tests +from . import all_tests import gdata.test_config as conf --- ./tests/all_tests.py (original) +++ ./tests/all_tests.py (refactored) @@ -22,38 +22,38 @@ import unittest # Tests for v2 features. -import atom_tests.core_test -import atom_tests.data_test -import atom_tests.http_core_test -import atom_tests.auth_test -import atom_tests.mock_http_core_test -import atom_tests.client_test -import gdata_tests.client_test -import gdata_tests.core_test -import gdata_tests.data_test -import gdata_tests.data_smoke_test -import gdata_tests.client_smoke_test -import gdata_tests.live_client_test -import gdata_tests.gauth_test -import gdata_tests.blogger.data_test -import gdata_tests.blogger.live_client_test -import gdata_tests.spreadsheets.data_test -import gdata_tests.spreadsheets.live_client_test -import gdata_tests.projecthosting.data_test -import gdata_tests.projecthosting.live_client_test -import gdata_tests.sites.data_test -import gdata_tests.sites.live_client_test -import gdata_tests.analytics.data_test -import gdata_tests.analytics.live_client_test -import gdata_tests.contacts.live_client_test -import gdata_tests.contacts.profiles.live_client_test -import gdata_tests.calendar_resource.live_client_test -import gdata_tests.calendar_resource.data_test -import gdata_tests.apps.emailsettings.data_test -import gdata_tests.apps.emailsettings.live_client_test -import gdata_tests.apps.multidomain.data_test -import gdata_tests.apps.multidomain.live_client_test -import gdata_tests.youtube.live_client_test +from . import atom_tests.core_test +from . import atom_tests.data_test +from . import atom_tests.http_core_test +from . import atom_tests.auth_test +from . import atom_tests.mock_http_core_test +from . import atom_tests.client_test +from . import gdata_tests.client_test +from . import gdata_tests.core_test +from . import gdata_tests.data_test +from . import gdata_tests.data_smoke_test +from . import gdata_tests.client_smoke_test +from . import gdata_tests.live_client_test +from . import gdata_tests.gauth_test +from . import gdata_tests.blogger.data_test +from . import gdata_tests.blogger.live_client_test +from . import gdata_tests.spreadsheets.data_test +from . import gdata_tests.spreadsheets.live_client_test +from . import gdata_tests.projecthosting.data_test +from . import gdata_tests.projecthosting.live_client_test +from . import gdata_tests.sites.data_test +from . import gdata_tests.sites.live_client_test +from . import gdata_tests.analytics.data_test +from . import gdata_tests.analytics.live_client_test +from . import gdata_tests.contacts.live_client_test +from . import gdata_tests.contacts.profiles.live_client_test +from . import gdata_tests.calendar_resource.live_client_test +from . import gdata_tests.calendar_resource.data_test +from . import gdata_tests.apps.emailsettings.data_test +from . import gdata_tests.apps.emailsettings.live_client_test +from . import gdata_tests.apps.multidomain.data_test +from . import gdata_tests.apps.multidomain.live_client_test +from . import gdata_tests.youtube.live_client_test def suite(): --- ./src/gdata/youtube/service.py (original) +++ ./src/gdata/youtube/service.py RefactoringTool: No changes to ./src/gdata/youtube/data.py RefactoringTool: No changes to ./src/gdata/youtube/client.py RefactoringTool: No changes to ./src/gdata/youtube/__init__.py RefactoringTool: Refactored ./src/gdata/webmastertools/service.py (refactored) @@ -629,12 +629,12 @@ # 'reason':'Accepted content types: %s' % # ['video/%s' % (t) for t in YOUTUBE_SUPPORTED_UPLOAD_TYPES]}) - if (isinstance(filename_or_handle, (str, unicode)) + if (isinstance(filename_or_handle, str) and os.path.exists(filename_or_handle)): mediasource = gdata.MediaSource() mediasource.setFile(filename_or_handle, content_type) elif hasattr(filename_or_handle, 'read'): - import StringIO + import io if hasattr(filename_or_handle, 'seek'): filename_or_handle.seek(0) file_handle = filename_or_handle @@ -657,7 +657,7 @@ try: return self.Post(video_entry, uri=upload_uri, media_source=mediasource, converter=gdata.youtube.YouTubeVideoEntryFromString) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise YouTubeError(e.args[0]) finally: del(self.additional_headers['Slug']) @@ -717,7 +717,7 @@ """ try: response = self.Post(video_entry, uri) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise YouTubeError(e.args[0]) tree = ElementTree.fromstring(response) --- ./src/gdata/webmastertools/service.py (original) +++ ./src/gdata/webmastertools/service.py (refactored) @@ -23,7 +23,7 @@ __author__ = 'livibetter (Yu-Jie Lin)' -import urllib +import urllib.request, urllib.parse, urllib.error import gdata import atom.service import gdata.service @@ -132,7 +132,7 @@ """ return self.Delete( - uri % urllib.quote_plus(site_uri), + uri % urllib.parse.quote_plus(site_uri), url_params=url_params, escape_params=escape_params) def VerifySite(self, site_uri, verification_method, uri=SITE_TEMPLATE, @@ -169,7 +169,7 @@ ) response = self.Put( site_entry, - uri % urllib.quote_plus(site_uri), + uri % urllib.parse.quote_plus(site_uri), url_params=url_params, escape_params=escape_params, converter=converter) if not converter and isinstance(response, atom.Entry): @@ -210,7 +210,7 @@ ) response = self.Put( site_entry, - uri % urllib.quote_plus(site_uri), + uri % urllib.parse.quote_plus(site_uri), url_params=url_params, escape_params=escape_params, converter=converter) if not converter and isinstance(response, atom.Entry): @@ -250,7 +250,7 @@ ) response = self.Put( site_entry, - uri % urllib.quote_plus(site_uri), + uri % urllib.parse.quote_plus(site_uri), url_params=url_params, escape_params=escape_params, converter=converter) if not converter and isinstance(response, atom.Entry): @@ -293,7 +293,7 @@ ) response = self.Put( site_entry, - uri % urllib.quote_plus(site_uri), + uri % urllib.parse.quote_plus(site_uri), url_params=url_params, escape_params=escape_params, converter=converter) if not converter and isinstance(response, atom.Entry): @@ -334,7 +334,7 @@ ) response = self.Put( site_entry, - uri % urllib.quote_plus(site_uri), + uri % urllib.parse.quote_plus(site_uri), url_params=url_params, escape_params=escape_params, converter=converter) if not converter and isinstance(response, atom.Entry): @@ -357,7 +357,7 @@ If converter is defined, the results of running converter on the server's response. Otherwise, it will be a SitemapsFeed object. """ - return self.Get(uri % {'site_id': urllib.quote_plus(site_uri)}, + return self.Get(uri % {'site_id': urllib.parse.quote_plus(site_uri)}, converter=converter) def AddSitemap(self, site_uri, sitemap_uri, sitemap_type='WEB', @@ -393,7 +393,7 @@ sitemap_type=webmastertools.SitemapType(text=sitemap_type)) response = self.Post( sitemap_entry, - uri % {'site_id': urllib.quote_plus(site_uri)}, + uri % {'sitRefactoringTool: No changes to ./src/gdata/webmastertools/data.py RefactoringTool: No changes to ./src/gdata/webmastertools/__init__.py RefactoringTool: Refactored ./src/gdata/urlfetch.py RefactoringTool: No changes to ./src/gdata/test_data.py RefactoringTool: Refactored ./src/gdata/test_config.py e_id': urllib.parse.quote_plus(site_uri)}, url_params=url_params, escape_params=escape_params, converter=converter) if not converter and isinstance(response, atom.Entry): @@ -434,10 +434,10 @@ sitemap_mobile_markup_language=\ webmastertools.SitemapMobileMarkupLanguage( text=sitemap_mobile_markup_language)) - print sitemap_entry + print(sitemap_entry) response = self.Post( sitemap_entry, - uri % {'site_id': urllib.quote_plus(site_uri)}, + uri % {'site_id': urllib.parse.quote_plus(site_uri)}, url_params=url_params, escape_params=escape_params, converter=converter) if not converter and isinstance(response, atom.Entry): @@ -482,10 +482,10 @@ for label in sitemap_news_publication_label: sitemap_entry.sitemap_news_publication_label.append( webmastertools.SitemapNewsPublicationLabel(text=label)) - print sitemap_entry + print(sitemap_entry) response = self.Post( sitemap_entry, - uri % {'site_id': urllib.quote_plus(site_uri)}, + uri % {'site_id': urllib.parse.quote_plus(site_uri)}, url_params=url_params, escape_params=escape_params, converter=converter) if not converter and isinstance(response, atom.Entry): @@ -511,6 +511,6 @@ """ return self.Delete( - uri % {'site_id': urllib.quote_plus(site_uri), - 'sitemap_id': urllib.quote_plus(sitemap_uri)}, + uri % {'site_id': urllib.parse.quote_plus(site_uri), + 'sitemap_id': urllib.parse.quote_plus(sitemap_uri)}, url_params=url_params, escape_params=escape_params) --- ./src/gdata/urlfetch.py (original) +++ ./src/gdata/urlfetch.py (refactored) @@ -38,7 +38,7 @@ __author__ = 'api.jscudder (Jeff Scudder)' -import StringIO +import io import atom.service import atom.http_interface from google.appengine.api import urlfetch @@ -188,7 +188,7 @@ if isinstance(service.additional_headers, dict): headers = service.additional_headers.copy() if isinstance(extra_headers, dict): - for header, value in extra_headers.iteritems(): + for header, value in extra_headers.items(): headers[header] = value # Add the content type header (we don't need to calculate content length, # since urlfetch.Fetch will calculate for us). @@ -229,7 +229,7 @@ """ def __init__(self, urlfetch_response): - self.body = StringIO.StringIO(urlfetch_response.content) + self.body = io.StringIO(urlfetch_response.content) self.headers = urlfetch_response.headers self.status = urlfetch_response.status_code self.reason = '' @@ -241,7 +241,7 @@ return self.body.read(length) def getheader(self, name): - if not self.headers.has_key(name): + if name not in self.headers: return self.headers[name.lower()] return self.headers[name] --- ./src/gdata/test_config.py (original) +++ ./src/gdata/test_config.py (refactored) @@ -63,7 +63,7 @@ def get(self): value = self.default # Check for a command line parameter. - for i in xrange(len(sys.argv)): + for i in range(len(sys.argv)): if sys.argv[i].startswith('--%s=' % self.name): value = sys.argv[i].split('=')[1] elif sys.argv[i] == '--%s' % self.name: @@ -77,8 +77,8 @@ if self.secret: value = getpass.getpass(prompt) else: - print 'You can specify this on the command line using --%s' % self.name - value = raw_input(prompt) + print('You can specify this on the command line using --%s' % self.name) + value = input(prompt) return value @@ -107,7 +107,7 @@ def render_usage(self): message_parts = [] - for opt_name, option in self.options.iteritems(): + for opt_name, option in self.options.items(): message_parts.append('--%s: %s' % (opt_name, option.description)) return '\n'.join(message_parts) @@ -395,7 +395,7 @@ def check_data_classes(test, classes): import inspect for data_class in classes: - test.assert_(data_class.__doRefactoringTool: Refactored ./src/gdata/spreadsheets/data.py RefactoringTool: Refactored ./src/gdata/spreadsheets/client.py RefactoringTool: Refactored ./src/gdata/spreadsheet/text_db.py c__ is not None, + test.assertTrue(data_class.__doc__ is not None, 'The class %s should have a docstring' % data_class) if hasattr(data_class, '_qname'): qname_versions = None @@ -404,13 +404,13 @@ else: qname_versions = (data_class._qname,) for versioned_qname in qname_versions: - test.assert_(isinstance(versioned_qname, str), + test.assertTrue(isinstance(versioned_qname, str), 'The class %s has a non-string _qname' % data_class) - test.assert_(not versioned_qname.endswith('}'), + test.assertTrue(not versioned_qname.endswith('}'), 'The _qname for class %s is only a namespace' % ( data_class)) - for attribute_name, value in data_class.__dict__.iteritems(): + for attribute_name, value in data_class.__dict__.items(): # Ignore all elements that start with _ (private members) if not attribute_name.startswith('_'): try: @@ -433,9 +433,9 @@ def check_clients_with_auth(test, classes): for client_class in classes: - test.assert_(hasattr(client_class, 'api_version')) - test.assert_(isinstance(client_class.auth_service, (str, unicode, int))) - test.assert_(hasattr(client_class, 'auth_service')) - test.assert_(isinstance(client_class.auth_service, (str, unicode))) - test.assert_(hasattr(client_class, 'auth_scopes')) - test.assert_(isinstance(client_class.auth_scopes, (list, tuple))) + test.assertTrue(hasattr(client_class, 'api_version')) + test.assertTrue(isinstance(client_class.auth_service, (str, int))) + test.assertTrue(hasattr(client_class, 'auth_service')) + test.assertTrue(isinstance(client_class.auth_service, str)) + test.assertTrue(hasattr(client_class, 'auth_scopes')) + test.assertTrue(isinstance(client_class.auth_scopes, (list, tuple))) --- ./src/gdata/spreadsheets/data.py (original) +++ ./src/gdata/spreadsheets/data.py (refactored) @@ -306,7 +306,7 @@ Old values which are already in the entry will not be removed unless they are overwritten with new values from the dict. """ - for column, value in values.iteritems(): + for column, value in values.items(): self.set_value(column, value) --- ./src/gdata/spreadsheets/client.py (original) +++ ./src/gdata/spreadsheets/client.py (refactored) @@ -200,7 +200,7 @@ data = gdata.spreadsheets.data.Data( insertion_mode=insertion_mode, num_rows=str(num_rows), start_row=str(start_row)) - for index, name in column_headers.iteritems(): + for index, name in column_headers.items(): data.column.append(gdata.spreadsheets.data.Column( index=index, name=name)) new_table = gdata.spreadsheets.data.Table( @@ -265,7 +265,7 @@ new_record = gdata.spreadsheets.data.Record() if title is not None: new_record.title = atom.data.Title(text=title) - for name, value in fields.iteritems(): + for name, value in fields.items(): new_record.field.append(gdata.spreadsheets.data.Field( name=name, text=value)) return self.post(new_record, RECORDS_URL % (spreadsheet_key, table_id), --- ./src/gdata/spreadsheet/text_db.py (original) +++ ./src/gdata/spreadsheet/text_db.py (refactored) @@ -15,7 +15,7 @@ # limitations under the License. -import StringIO +import io import gdata import gdata.service import gdata.spreadsheet @@ -141,7 +141,7 @@ # Create a Google Spreadsheet to form the foundation of this database. # Spreadsheet is created by uploading a file to the Google Documents # List API. - virtual_csv_file = StringIO.StringIO(',,,') + virtual_csv_file = io.StringIO(',,,') virtual_media_source = gdata.MediaSource(file_handle=virtual_csv_file, content_type='text/csv', content_length=3) db_entry = self.__docs_client.UploadSpreadsheet(virtual_media_source, name) return Database(spreadsheet_entry=db_entry, database_client=self) @@ -503,7 +503,7 @@ self.content = {} if entry: self.row_id = entry.id.text.split('/')RefactoringTool: Refactored ./src/gdata/spreadsheet/service.py RefactoringTool: Refactored ./src/gdata/spreadsheet/__init__.py RefactoringTool: No changes to ./src/gdata/sites/data.py RefactoringTool: Refactored ./src/gdata/sites/client.py RefactoringTool: Refactored ./src/gdata/service.py [-1] - for label, custom in entry.custom.iteritems(): + for label, custom in entry.custom.items(): self.content[label] = custom.text def Push(self): --- ./src/gdata/spreadsheet/service.py (original) +++ ./src/gdata/spreadsheet/service.py (refactored) @@ -326,7 +326,7 @@ The inserted row """ new_entry = gdata.spreadsheet.SpreadsheetsList() - for k, v in row_data.iteritems(): + for k, v in row_data.items(): new_custom = gdata.spreadsheet.Custom() new_custom.column = k new_custom.text = v @@ -354,7 +354,7 @@ The updated row """ entry.custom = {} - for k, v in new_row_data.iteritems(): + for k, v in new_row_data.items(): new_custom = gdata.spreadsheet.Custom() new_custom.column = k new_custom.text = v --- ./src/gdata/spreadsheet/__init__.py (original) +++ ./src/gdata/spreadsheet/__init__.py (refactored) @@ -142,7 +142,7 @@ # Fill in the instance members from the contents of the XML tree. for child in tree: self._ConvertElementTreeToMember(child) - for attribute, value in tree.attrib.iteritems(): + for attribute, value in tree.attrib.items(): self._ConvertElementAttributeToMember(attribute, value) self.text = tree.text @@ -318,7 +318,7 @@ # convert custom attributes to members def _ConvertElementTreeToMember(self, child_tree): # Find the element's tag in this class's list of child members - if self.__class__._children.has_key(child_tree.tag): + if child_tree.tag in self.__class__._children: member_name = self.__class__._children[child_tree.tag][0] member_class = self.__class__._children[child_tree.tag][1] # If the class member is supposed to contain a list, make sure the @@ -348,7 +348,7 @@ # This uses the class's _children dictionary to find the members which # should become XML child nodes. member_node_names = [values[0] for tag, values in - self.__class__._children.iteritems()] + self.__class__._children.items()] for member_name in member_node_names: member = getattr(self, member_name) if member is None: @@ -359,12 +359,12 @@ else: member._BecomeChildElement(tree) # Convert the members of this class which are XML attributes. - for xml_attribute, member_name in self.__class__._attributes.iteritems(): + for xml_attribute, member_name in self.__class__._attributes.items(): member = getattr(self, member_name) if member is not None: tree.attrib[xml_attribute] = member # Convert all special custom item attributes to nodes - for name, custom in self.custom.iteritems(): + for name, custom in self.custom.items(): custom._BecomeChildElement(tree) # Lastly, call the ExtensionContainers's _AddMembersToElementTree to # convert any extension attributes. --- ./src/gdata/sites/client.py (original) +++ ./src/gdata/sites/client.py (refactored) @@ -102,9 +102,9 @@ """ server_response = self.request('GET', uri) if server_response.status != 200: - raise gdata.client.RequestError, {'status': server_response.status, + raise gdata.client.RequestError({'status': server_response.status, 'reason': server_response.reason, - 'body': server_response.read()} + 'body': server_response.read()}) return server_response.read() _GetFileContent = _get_file_content @@ -471,7 +471,7 @@ f = open(file_path, 'wb') try: f.write(self._get_file_content(uri)) - except gdata.client.RequestError, e: + except gdata.client.RequestError as e: f.close() raise e f.flush() --- ./src/gdata/service.py (original) +++ ./src/gdata/service.py (refactored) @@ -60,8 +60,8 @@ __author__ = 'api.jscudder (Jeffrey Scudder)' import re -import urllib -import urlparse +import urllib.request, urllib.parse, urllib.error +import urllib.parse try: from xml.etree import cElementTree as ElementTree except ImportError: @@ -785,22 +785,22 @@ if captcha_parameters: self.__captcha_token = captcha_parameters['token'] self.__captcha_url = captcha_parameters['url'] - raise CaptchaRequired, 'Captcha Required' + raise CaptchaRequired('Captcha Required') elif response_body.splitlines()[0] == 'Error=BadAuthentication': self.__captcha_token = None self.__captcha_url = None - raise BadAuthentication, 'Incorrect username or password' + raise BadAuthentication('Incorrect username or password') else: self.__captcha_token = None self.__captcha_url = None - raise Error, 'Server responded with a 403 code' + raise Error('Server responded with a 403 code') elif auth_response.status == 302: self.__captcha_token = None self.__captcha_url = None # Google tries to redirect all bad URLs back to # http://www.google.. If a redirect # attempt is made, assume the user has supplied an incorrect authentication URL - raise BadAuthenticationServiceURL, 'Server responded with a 302 code.' + raise BadAuthenticationServiceURL('Server responded with a 302 code.') def ClientLogin(self, username, password, account_type=None, service=None, auth_service_url=None, source=None, captcha_token=None, @@ -945,8 +945,8 @@ if response.status == 200: return result_body else: - raise RequestError, {'status': response.status, - 'body': result_body} + raise RequestError({'status': response.status, + 'body': result_body}) def GetWithRetries(self, uri, extra_headers=None, redirects_remaining=4, encoding='UTF-8', converter=None, num_retries=DEFAULT_NUM_RETRIES, @@ -996,13 +996,13 @@ except SystemExit: # Allow this error raise - except RequestError, e: + except RequestError as e: # Error 500 is 'internal server error' and warrants a retry # Error 503 is 'service unavailable' and warrants a retry if e[0]['status'] not in [500, 503]: raise e # Else, fall through to the retry code... - except Exception, e: + except Exception as e: if logger: logger.debug(e) # Fall through to the retry code... @@ -1095,16 +1095,16 @@ return GDataService.Get(self, location, extra_headers, redirects_remaining - 1, encoding=encoding, converter=converter) else: - raise RequestError, {'status': server_response.status, + raise RequestError({'status': server_response.status, 'reason': '302 received without Location header', - 'body': result_body} + 'body': result_body}) else: - raise RequestError, {'status': server_response.status, + raise RequestError({'status': server_response.status, 'reason': 'Redirect received, but redirects_remaining <= 0', - 'body': result_body} - else: - raise RequestError, {'status': server_response.status, - 'reason': server_response.reason, 'body': result_body} + 'body': result_body}) + else: + raise RequestError({'status': server_response.status, + 'reason': server_response.reason, 'body': result_body}) def GetMedia(self, uri, extra_headers=None): """Returns a MediaSource containing media and its metadata from the given @@ -1139,7 +1139,7 @@ if isinstance(result, atom.Entry): return result else: - raise UnexpectedReturnType, 'Server did not send an entry' + raise UnexpectedReturnType('Server did not send an entry') def GetFeed(self, uri, extra_headers=None, converter=gdata.GDataFeedFromString): @@ -1164,7 +1164,7 @@ if isinstance(result, atom.Feed): return result else: - raise UnexpectedReturnType, 'Server did not send a feed' + raise UnexpectedReturnType('Server did not send a feed') def GetNext(self, feed): """Requests the next 'page' of results in the feed. @@ -1345,16 +1345,16 @@ extra_headers, url_params, escape_params, redirects_remaining - 1, media_source, converter=converter) else: - raise RequestError, {'status': server_response.status, + raise RequestError({'status': server_response.status, 'reason': '302 received without Location header', - 'body': result_body} + 'body': result_body}) else: - raise RequestError, {'status': server_response.status, + raise RequestError({'status': server_response.status, 'reason': 'Redirect received, but redirects_remaining <= 0', - 'body': result_body} - else: - raise RequestError, {'status': server_response.status, - 'reason': server_response.reason, 'body': result_body} + 'body': result_body}) + else: + raise RequestError({'status': server_response.status, + 'reason': server_response.reason, 'body': result_body}) def Put(self, data, uri, extra_headers=None, url_params=None, escape_params=True, redirects_remaining=3, media_source=None, @@ -1442,16 +1442,16 @@ return GDataService.Delete(self, location, extra_headers, url_params, escape_params, redirects_remaining - 1) else: - raise RequestError, {'status': server_response.status, + raise RequestError({'status': server_response.status, 'reason': '302 received without Location header', - 'body': result_body} + 'body': result_body}) else: - raise RequestError, {'status': server_response.status, + raise RequestError({'status': server_response.status, 'reason': 'Redirect received, but redirects_remaining <= 0', - 'body': result_body} - else: - raise RequestError, {'status': server_response.status, - 'reason': server_response.reason, 'body': result_body} + 'body': result_body}) + else: + raise RequestError({'status': server_response.status, + 'reason': server_response.reason, 'body': result_body}) def ExtractToken(url, scopes_included_in_next=True): @@ -1474,13 +1474,13 @@ this token should be valid. If the scope was not included in the URL, the tuple will contain (token, None). """ - parsed = urlparse.urlparse(url) + parsed = urllib.parse.urlparse(url) token = gdata.auth.AuthSubTokenFromUrl(parsed[4]) scopes = '' if scopes_included_in_next: for pair in parsed[4].split('&'): if pair.startswith('%s=' % SCOPE_URL_PARAM_NAME): - scopes = urllib.unquote_plus(pair.split('=')[1]) + scopes = urllib.parse.unquote_plus(pair.split('=')[1]) return (token, scopes.split(' ')) @@ -1527,9 +1527,9 @@ scope = scopes if include_scopes_in_next: if next.find('?') > -1: - next += '&%s' % urllib.urlencode({SCOPE_URL_PARAM_NAME:scope}) - else: - next += '?%s' % urllib.urlencode({SCOPE_URL_PARAM_NAME:scope}) + next += '&%s' % urllib.parse.urlencode({SCOPE_URL_PARAM_NAME:scope}) + else: + next += '?%s' % urllib.parse.urlencode({SCOPE_URL_PARAM_NAME:scope}) return gdata.auth.GenerateAuthSubUrl(next=next, scope=scope, secure=secure, session=session, request_url=request_url, domain=hd) @@ -1581,7 +1581,7 @@ self.categories.append(category) def _GetTextQuery(self): - if 'q' in self.keys(): + if 'q' in list(self.keys()): return self['q'] else: return None @@ -1593,7 +1593,7 @@ doc="""The feed query's q parameter""") def _GetAuthor(self): - if 'author' in self.keys(): + if 'author' in list(self.keys()): return self['author'] else: return None @@ -1605,7 +1605,7 @@ doc="""The feed query's author parameter""") def _GetAlt(self): - if 'alt' in self.keys(): + if 'alt' in list(self.keys()): return self['alt'] else: RefactoringTool: Refactored ./src/gdata/sample_util.py return None @@ -1617,7 +1617,7 @@ doc="""The feed query's alt parameter""") def _GetUpdatedMin(self): - if 'updated-min' in self.keys(): + if 'updated-min' in list(self.keys()): return self['updated-min'] else: return None @@ -1629,7 +1629,7 @@ doc="""The feed query's updated-min parameter""") def _GetUpdatedMax(self): - if 'updated-max' in self.keys(): + if 'updated-max' in list(self.keys()): return self['updated-max'] else: return None @@ -1641,7 +1641,7 @@ doc="""The feed query's updated-max parameter""") def _GetPublishedMin(self): - if 'published-min' in self.keys(): + if 'published-min' in list(self.keys()): return self['published-min'] else: return None @@ -1653,7 +1653,7 @@ doc="""The feed query's published-min parameter""") def _GetPublishedMax(self): - if 'published-max' in self.keys(): + if 'published-max' in list(self.keys()): return self['published-max'] else: return None @@ -1665,7 +1665,7 @@ doc="""The feed query's published-max parameter""") def _GetStartIndex(self): - if 'start-index' in self.keys(): + if 'start-index' in list(self.keys()): return self['start-index'] else: return None @@ -1679,7 +1679,7 @@ doc="""The feed query's start-index parameter""") def _GetMaxResults(self): - if 'max-results' in self.keys(): + if 'max-results' in list(self.keys()): return self['max-results'] else: return None @@ -1693,7 +1693,7 @@ doc="""The feed query's max-results parameter""") def _GetOrderBy(self): - if 'orderby' in self.keys(): + if 'orderby' in list(self.keys()): return self['orderby'] else: return None @@ -1707,7 +1707,7 @@ def ToUri(self): q_feed = self.feed or '' category_string = '/'.join( - [urllib.quote_plus(c) for c in self.categories]) + [urllib.parse.quote_plus(c) for c in self.categories]) # Add categories to the feed if there are any. if len(self.categories) > 0: q_feed = q_feed + '/-/' + category_string --- ./src/gdata/sample_util.py (original) +++ ./src/gdata/sample_util.py (refactored) @@ -21,7 +21,7 @@ import sys import getpass -import urllib +import urllib.request, urllib.parse, urllib.error import gdata.gauth __author__ = 'j.s@google.com (Jeff Scudder)' @@ -53,7 +53,7 @@ return self.prefs[name] # Second, check for a command line parameter. value = None - for i in xrange(len(sys.argv)): + for i in range(len(sys.argv)): if sys.argv[i].startswith('--%s=' % name): value = sys.argv[i].split('=')[1] elif sys.argv[i] == '--%s' % name: @@ -65,7 +65,7 @@ if secret: value = getpass.getpass(prompt) else: - value = raw_input(prompt) + value = input(prompt) # If we want to save the preference for reuse in future requests, add it # to this object's prefs. if value is not None and reuse: @@ -96,7 +96,7 @@ 'between each URL.\n' 'Example: http://www.google.com/calendar/feeds/,' 'http://www.google.com/m8/feeds/\n', reuse=True).split(',') - elif isinstance(scopes, (str, unicode)): + elif isinstance(scopes, str): scopes = scopes.split(',') if auth_type == CLIENT_LOGIN: @@ -131,7 +131,7 @@ private_key = private_key_file.read() private_key_file.close() except IOError: - print 'Unable to read private key from file' + print('Unable to read private key from file') if private_key is not None: if client.auth_token is None: @@ -151,7 +151,7 @@ auth_url = gdata.gauth.generate_auth_sub_url( 'http://gauthmachine.appspot.com/authsub', scopes, True) - print 'with a private key, get ready for this URL', auth_url + print('with a private key, get ready for this URL', auth_url) else: if client.auth_token is None: @@ -172,12 +172,12 @@ RefactoringTool: No changes to ./src/gdata/projecthosting/data.py RefactoringTool: No changes to ./src/gdata/projecthosting/client.py RefactoringTool: Refactored ./src/gdata/photos/service.py WARNING: couldn't encode ./src/gdata/photos/service.py's diff for your terminal RefactoringTool: Refactored ./src/gdata/photos/__init__.py WARNING: couldn't encode ./src/gdata/photos/__init__.py's diff for your terminal RefactoringTool: No changes to ./src/gdata/opensearch/data.py RefactoringTool: No changes to ./src/gdata/oauth/rsa.py RefactoringTool: Refactored ./src/gdata/oauth/__init__.py auth_url = gdata.gauth.generate_auth_sub_url( 'http://gauthmachine.appspot.com/authsub', scopes) - print 'Visit the following URL in your browser to authorize this app:' - print str(auth_url) - print 'After agreeing to authorize the app, copy the token value from' - print ' the URL. Example: "www.google.com/?token=ab12" token value is' - print ' ab12' - token_value = raw_input('Please enter the token value: ') + print('Visit the following URL in your browser to authorize this app:') + print(str(auth_url)) + print('After agreeing to authorize the app, copy the token value from') + print(' the URL. Example: "www.google.com/?token=ab12" token value is') + print(' ab12') + token_value = input('Please enter the token value: ') if private_key is not None: single_use_token = gdata.gauth.SecureAuthSubToken( token_value, private_key, scopes) @@ -221,21 +221,21 @@ private_key = private_key_file.read() private_key_file.close() except IOError: - print 'Unable to read private key from file' + print('Unable to read private key from file') request_token = client.get_oauth_token( scopes, 'http://gauthmachine.appspot.com/oauth', consumer_key, rsa_private_key=private_key) else: - print 'Invalid OAuth signature type' + print('Invalid OAuth signature type') return None # Authorize the request token in the browser. - print 'Visit the following URL in your browser to authorize this app:' - print str(request_token.generate_authorization_url()) - print 'After agreeing to authorize the app, copy URL from the browser\'s' - print ' address bar.' - url = raw_input('Please enter the url: ') + print('Visit the following URL in your browser to authorize this app:') + print(str(request_token.generate_authorization_url())) + print('After agreeing to authorize the app, copy URL from the browser\'s') + print(' address bar.') + url = input('Please enter the url: ') gdata.gauth.authorize_request_token(request_token, url) # Exchange for an access token. client.auth_token = client.get_access_token(request_token) @@ -258,19 +258,19 @@ scope = " ".join(scopes), # http://stackoverflow.com/a/8451199/198219 user_agent = 'GdataPythonClientExample') else: - print 'Invalid OAuth signature type' + print('Invalid OAuth signature type') return None # Authorize the request token in the browser. - print '\nVisit the following URL in your browser '\ + print('\nVisit the following URL in your browser '\ 'to authorize this app:\n\n{0}\n'.format( - str(request_token.generate_authorize_url())) - - code = raw_input('What is the verification code? ').strip() + str(request_token.generate_authorize_url()))) + + code = input('What is the verification code? ').strip() request_token.get_access_token(code) client.auth_token = request_token else: - print 'Invalid authorization type.' + print('Invalid authorization type.') return None if client.auth_token: self.prefs['client_auth_token'] = gdata.gauth.token_to_blob( @@ -297,5 +297,5 @@ def print_options(): """Displays usage information, available command line params.""" # TODO: fill in the usage description for authorizing the client. - print '' - + print('') + --- ./src/gdata/photos/service.py (original) +++ ./src/gdata/photos/service.py (refactored) @@ -75,12 +75,12 @@ """ --- ./src/gdata/photos/__init__.py (original) +++ ./src/gdata/photos/__init__.py (refactored) @@ -33,7 +33,7 @@ """ --- ./src/gdata/oauth/__init__.py (original) +++ ./src/gdata/oauth/__init__.py (refactored) @@ -1,8 +1,8 @@ import cgi -import urllib +import urllib.request, urllib.parse, urllib.error import time import random -import urlparse +import urllib.parse import hmac importRefactoringTool: No changes to ./src/gdata/notebook/data.py RefactoringTool: No changes to ./src/gdata/media/data.py RefactoringTool: Refactored ./src/gdata/media/__init__.py binascii @@ -22,7 +22,7 @@ # url escape def escape(s): # escape '/' too - return urllib.quote(s, safe='~') + return urllib.parse.quote(s, safe='~') # util function: current timestamp # seconds since epoch (UTC) @@ -60,7 +60,7 @@ self.secret = secret def to_string(self): - return urllib.urlencode({'oauth_token': self.key, 'oauth_token_secret': self.secret}) + return urllib.parse.urlencode({'oauth_token': self.key, 'oauth_token_secret': self.secret}) # return a token from something like: # oauth_token_secret=digg&oauth_token=digg @@ -112,7 +112,7 @@ # get any non-oauth parameters def get_nonoauth_parameters(self): parameters = {} - for k, v in self.parameters.iteritems(): + for k, v in self.parameters.items(): # ignore oauth parameters if k.find('oauth_') < 0: parameters[k] = v @@ -123,14 +123,14 @@ auth_header = 'OAuth realm="%s"' % realm # add the oauth parameters if self.parameters: - for k, v in self.parameters.iteritems(): + for k, v in self.parameters.items(): if k[:6] == 'oauth_': auth_header += ', %s="%s"' % (k, escape(str(v))) return {'Authorization': auth_header} # serialize as post data for a POST request def to_postdata(self): - return '&'.join(['%s=%s' % (escape(str(k)), escape(str(v))) for k, v in self.parameters.iteritems()]) + return '&'.join(['%s=%s' % (escape(str(k)), escape(str(v))) for k, v in self.parameters.items()]) # serialize as a url for a GET request def to_url(self): @@ -144,7 +144,7 @@ del params['oauth_signature'] except: pass - key_values = params.items() + key_values = list(params.items()) # sort lexicographically, first after key, then after value key_values.sort() # combine key value pairs in string and escape @@ -156,7 +156,7 @@ # parses the url and rebuilds it to be scheme://host/path def get_normalized_http_url(self): - parts = urlparse.urlparse(self.http_url) + parts = urllib.parse.urlparse(self.http_url) host = parts[1].lower() if host.endswith(':80') or host.endswith(':443'): host = host.split(':')[0] @@ -197,7 +197,7 @@ parameters.update(query_params) # URL parameters - param_str = urlparse.urlparse(http_url)[4] # query + param_str = urllib.parse.urlparse(http_url)[4] # query url_params = OAuthRequest._split_url_string(param_str) parameters.update(url_params) @@ -252,7 +252,7 @@ # split key-value param_parts = param.split('=', 1) # remove quotes and unescape the value - params[param_parts[0]] = urllib.unquote(param_parts[1].strip('\"')) + params[param_parts[0]] = urllib.parse.unquote(param_parts[1].strip('\"')) return params _split_header = staticmethod(_split_header) @@ -260,8 +260,8 @@ # even empty values should be included def _split_url_string(param_str): parameters = cgi.parse_qs(param_str, keep_blank_values=True) - for k, v in parameters.iteritems(): - parameters[k] = urllib.unquote(v[0]) + for k, v in parameters.items(): + parameters[k] = urllib.parse.unquote(v[0]) return parameters _split_url_string = staticmethod(_split_url_string) @@ -355,7 +355,7 @@ # get the signature method object signature_method = self.signature_methods[signature_method] except: - signature_method_names = ', '.join(self.signature_methods.keys()) + signature_method_names = ', '.join(list(self.signature_methods.keys())) raise OAuthError('Signature method %s not supported try one of the following: %s' % (signature_method, signature_method_names)) return signature_method --- ./src/gdata/media/__init__.py (original) +++ ./WARNING: couldn't encode ./src/gdata/media/__init__.py's diff for your terminal RefactoringTool: No changes to ./src/gdata/marketplace/data.py RefactoringTool: Refactored ./src/gdata/marketplace/client.py RefactoringTool: No changes to ./src/gdata/health/service.py RefactoringTool: No changes to ./src/gdata/health/__init__.py RefactoringTool: No changes to ./src/gdata/geo/data.py RefactoringTool: Refactored ./src/gdata/geo/__init__.py WARNING: couldn't encode ./src/gdata/geo/__init__.py's diff for your terminal RefactoringTool: Refactored ./src/gdata/gauth.py src/gdata/media/__init__.py (refactored) @@ -45,7 +45,7 @@ media:title """ --- ./src/gdata/marketplace/client.py (original) +++ ./src/gdata/marketplace/client.py (refactored) @@ -26,7 +26,7 @@ import gdata.marketplace.data import gdata.client -import urllib +import urllib.request, urllib.parse, urllib.error # Feed URI template. This must end with a / @@ -76,9 +76,9 @@ Apps domain. """ parameters = '[appid=%s][domain=%s]' % (app_id, self.domain) - uri = LICENSE_FEED_TEMPLATE + urllib.quote_plus(parameters) + uri = LICENSE_FEED_TEMPLATE + urllib.parse.quote_plus(parameters) if params: - uri += '&' + urllib.urlencode(params) + uri += '&' + urllib.parse.urlencode(params) return uri MakeLicenseFeedUri = make_license_feed_uri @@ -108,9 +108,9 @@ parameters += '[max-results=%s]' % max_results else: parameters += '[max-results=100]' - uri = LICENSE_NOTIFICATIONS_FEED_TEMPLATE + urllib.quote_plus(parameters) + uri = LICENSE_NOTIFICATIONS_FEED_TEMPLATE + urllib.parse.quote_plus(parameters) if params: - uri += '&' + urllib.urlencode(params) + uri += '&' + urllib.parse.urlencode(params) return uri MakeLicenseNotificationsFeedUri = make_license_notifications_feed_uri --- ./src/gdata/geo/__init__.py (original) +++ ./src/gdata/geo/__init__.py (refactored) @@ -39,7 +39,7 @@ #elements mentioned above, but this module will let you seamlessly convert #between the different formats (TODO 2007-10-18 hg) --- ./src/gdata/gauth.py (original) +++ ./src/gdata/gauth.py (refactored) @@ -49,8 +49,8 @@ import datetime import time import random -import urllib -import urlparse +import urllib.request, urllib.parse, urllib.error +import urllib.parse import atom.http_core try: @@ -66,7 +66,7 @@ import json as simplejson try: - from urlparse import parse_qsl + from urllib.parse import parse_qsl except ImportError: from cgi import parse_qsl @@ -216,7 +216,7 @@ # user is responding to a captch challenge. request_fields['logintoken'] = captcha_token request_fields['logincaptcha'] = captcha_response - return urllib.urlencode(request_fields) + return urllib.parse.urlencode(request_fields) GenerateClientLoginRequestBody = generate_client_login_request_body @@ -301,7 +301,7 @@ # AuthSub functions and classes. def _to_uri(str_or_uri): - if isinstance(str_or_uri, (str, unicode)): + if isinstance(str_or_uri, str): return atom.http_core.Uri.parse_uri(str_or_uri) return str_or_uri @@ -350,16 +350,16 @@ An atom.http_core.Uri which the user's browser should be directed to in order to authorize this application to access their information. """ - if isinstance(next, (str, unicode)): + if isinstance(next, str): next = atom.http_core.Uri.parse_uri(next) # If the user passed in a string instead of a list for scopes, convert to # a single item tuple. - if isinstance(scopes, (str, unicode, atom.http_core.Uri)): + if isinstance(scopes, (str, atom.http_core.Uri)): scopes = (scopes,) scopes_string = ' '.join([str(scope) for scope in scopes]) next.query[scopes_param_prefix] = scopes_string - if isinstance(request_url, (str, unicode)): + if isinstance(request_url, str): request_url = atom.http_core.Uri.parse_uri(request_url) request_url.query['next'] = str(next) request_url.query['scope'] = scopes_string @@ -400,7 +400,7 @@ None. If there was no token param in the url, the tuple returned is (None, None) """ - if isinstance(url, (str, unicode)): + if isinstance(url, str): url = atom.http_core.Uri.parse_uri(url) if 'token' not in url.query: return (None, None) @@ -551,7 +551,7 @@ not be valid. """ timestamp = str(int(time.time())) - nonce = ''.join([str(random.randint(0, 9)) for i in xrange(15)]) + nonce = ''.join([str(random.randint(0, 9)) for i in range(15)]) data = build_auth_sub_data(http_request, timestamp, nonce) signature = generate_signature(data, self.rsa_private_key) http_request.headers['Authorization'] = ( @@ -615,14 +615,14 @@ sorted_keys = sorted(params.keys()) # The sorted function is not available in Python2.3 and lower except NameError: - sorted_keys = params.keys() + sorted_keys = list(params.keys()) sorted_keys.sort() pairs = [] for key in sorted_keys: - pairs.append('%s=%s' % (urllib.quote(key, safe='~'), - urllib.quote(params[key], safe='~'))) + pairs.append('%s=%s' % (urllib.parse.quote(key, safe='~'), + urllib.parse.quote(params[key], safe='~'))) # We want to escape /'s too, so use safe='~' - all_parameters = urllib.quote('&'.join(pairs), safe='~') + all_parameters = urllib.parse.quote('&'.join(pairs), safe='~') normailzed_host = http_request.uri.host.lower() normalized_scheme = (http_request.uri.scheme or 'http').lower() non_default_port = None @@ -637,12 +637,12 @@ if non_default_port is not None: # Set the only safe char in url encoding to ~ since we want to escape / # as well. - request_path = urllib.quote('%s://%s:%s%s' % ( + request_path = urllib.parse.quote('%s://%s:%s%s' % ( normalized_scheme, normailzed_host, non_default_port, path), safe='~') else: # Set the only safe char in url encoding to ~ since we want to escape / # as well. - request_path = urllib.quote('%s://%s%s' % ( + request_path = urllib.parse.quote('%s://%s%s' % ( normalized_scheme, normailzed_host, path), safe='~') # TODO: ensure that token escaping logic is correct, not sure if the token # value should be double escaped instead of single. @@ -663,10 +663,10 @@ hash_key = None hashed = None if token_secret is not None: - hash_key = '%s&%s' % (urllib.quote(consumer_secret, safe='~'), - urllib.quote(token_secret, safe='~')) + hash_key = '%s&%s' % (urllib.parse.quote(consumer_secret, safe='~'), + urllib.parse.quote(token_secret, safe='~')) else: - hash_key = '%s&' % urllib.quote(consumer_secret, safe='~') + hash_key = '%s&' % urllib.parse.quote(consumer_secret, safe='~') try: import hashlib hashed = hmac.new(hash_key, base_string, hashlib.sha1) @@ -734,7 +734,7 @@ params['oauth_verifier'] = verifier pairs = [ '%s="%s"' % ( - k, urllib.quote(v, safe='~')) for k, v in params.iteritems()] + k, urllib.parse.quote(v, safe='~')) for k, v in params.items()] return 'OAuth %s' % (', '.join(pairs)) @@ -777,7 +777,7 @@ request.uri.query['scope'] = ' '.join(scopes) timestamp = str(int(time.time())) - nonce = ''.join([str(random.randint(0, 9)) for i in xrange(15)]) + nonce = ''.join([str(random.randint(0, 9)) for i in range(15)]) signature = None if signature_type == HMAC_SHA1: signature = generate_hmac_signature( @@ -831,9 +831,9 @@ token_secret = None for pair in http_body.split('&'): if pair.startswith('oauth_token='): - token = urllib.unquote(pair[len('oauth_token='):]) + token = urllib.parse.unquote(pair[len('oauth_token='):]) if pair.startswith('oauth_token_secret='): - token_secret = urllib.unquote(pair[len('oauth_token_secret='):]) + token_secret = urllib.parse.unquote(pair[len('oauth_token_secret='):]) return (token, token_secret) @@ -902,14 +902,14 @@ A tuple of strings containing the OAuth token and the OAuth verifier which need to sent when upgrading a request token to an access token. """ - if isinstance(url, (str, unicode)): + if isinstance(url, str): url = atom.http_core.Uri.parse_uri(url) token = None verifier = None if 'oauth_token' in url.query: - token = urllib.unquote(url.query['oauth_token']) + token = urllib.parse.unquote(url.query['oauth_token']) if 'oauth_verifier' in url.query: - verifier = urllib.unquote(url.query['oauth_verifier']) + verifier = urllib.parse.unquote(url.query['oauth_verifier']) return (token, verifier) @@ -1028,14 +1028,14 @@ The same HTTP request object which was passed in. """ timestamp = str(int(time.time())) - nonce = ''.join([str(random.randint(0, 9)) for i in xrange(15)]) + nonce = ''.join([str(random.randint(0, 9)) for i in range(15)]) signature = generate_hmac_signature( http_request, self.consumer_key, self.consumer_secret, timestamp, - nonce, version='1.0', next=self.next, token=self.token, + nonce, version='1.0', next=self.__next__, token=self.token, token_secret=self.token_secret, verifier=self.verifier) http_request.headers['Authorization'] = generate_auth_header( self.consumer_key, timestamp, nonce, HMAC_SHA1, signature, - version='1.0', next=self.next, token=self.token, + version='1.0', next=self.__next__, token=self.token, verifier=self.verifier) return http_request @@ -1066,14 +1066,14 @@ The same HTTP request object which was passed in. """ timestamp = str(int(time.time())) - nonce = ''.join([str(random.randint(0, 9)) for i in xrange(15)]) + nonce = ''.join([str(random.randint(0, 9)) for i in range(15)]) signature = generate_rsa_signature( http_request, self.consumer_key, self.rsa_private_key, timestamp, - nonce, version='1.0', next=self.next, token=self.token, + nonce, version='1.0', next=self.__next__, token=self.token, token_secret=self.token_secret, verifier=self.verifier) http_request.headers['Authorization'] = generate_auth_header( self.consumer_key, timestamp, nonce, RSA_SHA1, signature, - version='1.0', next=self.next, token=self.token, + version='1.0', next=self.__next__, token=self.token, verifier=self.verifier) return http_request @@ -1192,7 +1192,7 @@ request: The atom.http_core.HttpRequest which contains all of the information needed to send a request to the remote server. """ - body = urllib.urlencode({ + body = urllib.parse.urlencode({ 'grant_type': 'refresh_token', 'client_id': self.client_id, 'client_secret': self.client_secret, @@ -1261,10 +1261,10 @@ 'access_type': access_type } query.update(kwargs) - parts = list(urlparse.urlparse(self.auth_uri)) + parts = list(urllib.parse.urlparse(self.auth_uri)) query.update(dict(parse_qsl(parts[4]))) # 4 is the index of the query part - parts[4] = urllib.urlencode(query) - return urlparse.urlunparse(parts) + parts[4] = urllib.parse.urlencode(query) + return urllib.parse.urlunparse(parts) def get_access_token(self, code): """Exhanges a code for an access token. @@ -1275,10 +1275,10 @@ the code. """ - if not (isinstance(code, str) or isinstance(code, unicode)): + if not (isinstance(code, str) or isinstance(code, str)): code = code['code'] - body = urllib.urlencode({ + body = urllib.parse.urlencode({ 'grant_type': 'authorization_code', 'client_id': self.client_id, 'client_secret': self.client_secret, @@ -1484,7 +1484,7 @@ Returns: A string in the form 1x|member1|member2|member3... """ - return '|'.join([urllib.quote_plus(a or '') for a in args]) + return '|'.join([urllib.parse.quote_plus(a or '') for a in args]) def _split_token_parts(blob): @@ -1502,7 +1502,7 @@ Returns: A list of unescaped strings. """ - return [urllib.unquote_plus(part) or None for part in blob.split('|')] + return [urllib.parse.unquote_plus(part) or None for part in blob.split('|')] def token_to_blob(token): @@ -1545,12 +1545,12 @@ elif isinstance(token, OAuthRsaToken): return _join_token_parts( '1r', token.consumer_key, token.rsa_private_key, token.token, - token.token_secret, str(token.auth_state), token.next, + token.token_secret, str(token.auth_state), token.__next__, token.verifier) elif isinstance(token, OAuthHmacToken): return _join_token_parts( '1h', token.consumer_key, token.consumer_secret, token.token, - token.token_secret, str(token.auth_state), token.next, + token.token_RefactoringTool: No changes to ./src/gdata/finance/service.py RefactoringTool: No changes to ./src/gdata/finance/data.py RefactoringTool: No changes to ./src/gdata/finance/__init__.py RefactoringTool: Refactored ./src/gdata/exif/__init__.py WARNING: couldn't encode ./src/gdata/exif/__init__.py's diff for your terminal RefactoringTool: No changes to ./src/gdata/dublincore/data.py RefactoringTool: Refactored ./src/gdata/docs/service.py RefactoringTool: Refactored ./src/gdata/docs/data.py RefactoringTool: Refactored ./src/gdata/docs/client.py secret, str(token.auth_state), token.__next__, token.verifier) elif isinstance(token, OAuth2Token): return _join_token_parts( @@ -1639,7 +1639,7 @@ """ result_scopes = [] if service_names is None: - for service_name, scopes in AUTH_SCOPES.iteritems(): + for service_name, scopes in AUTH_SCOPES.items(): result_scopes.extend(scopes) else: for service_name in service_names: --- ./src/gdata/exif/__init__.py (original) +++ ./src/gdata/exif/__init__.py (refactored) @@ -44,7 +44,7 @@ """ --- ./src/gdata/docs/service.py (original) +++ ./src/gdata/docs/service.py (refactored) @@ -32,7 +32,7 @@ import atom import gdata.service import gdata.docs -import urllib +import urllib.request, urllib.parse, urllib.error # XML Namespaces used in Google Documents entities. DATA_KIND_SCHEME = gdata.GDATA_NAMESPACE + '#kind' @@ -122,7 +122,7 @@ if label == SPREADSHEET_LABEL: return ('https://spreadsheets.google.com/feeds/download/spreadsheets/' 'Export?key=%s' % doc_id) - raise ValueError, 'Invalid resource id: %s' % resource_id + raise ValueError('Invalid resource id: %s' % resource_id) def _UploadFile(self, media_source, title, category, folder_or_uri=None): """Uploads a file to the Document List feed. @@ -179,9 +179,9 @@ response_body = server_response.read() timeout -= 1 if server_response.status != 200: - raise gdata.service.RequestError, {'status': server_response.status, + raise gdata.service.RequestError({'status': server_response.status, 'reason': server_response.reason, - 'body': response_body} + 'body': response_body}) f = open(file_path, 'wb') f.write(response_body) f.flush() @@ -331,17 +331,17 @@ if export_format is not None: if (url.find('/Export?') == -1) and (url.find('/export?') == -1): - raise gdata.service.Error, ('This entry cannot be exported ' + raise gdata.service.Error('This entry cannot be exported ' 'as a different format') url += '&exportFormat=%s' % export_format if gid is not None: if url.find('spreadsheets') == -1: - raise gdata.service.Error, 'grid id param is not valid for this entry' + raise gdata.service.Error('grid id param is not valid for this entry') url += '&gid=%s' % gid if extra_params: - url += '&' + urllib.urlencode(extra_params) + url += '&' + urllib.parse.urlencode(extra_params) self._DownloadFile(url, file_path) --- ./src/gdata/docs/data.py (original) +++ ./src/gdata/docs/data.py (refactored) @@ -178,8 +178,8 @@ atom.data.Category if found or None. """ try: - return self.get_categories(scheme).next() - except StopIteration, e: + return next(self.get_categories(scheme)) + except StopIteration as e: # The entry doesn't have the category return None @@ -367,7 +367,7 @@ entry = AclEntry() if role is not None: - if isinstance(role, basestring): + if isinstance(role, str): role = gdata.acl.data.AclRole(value=role) if key: @@ -409,11 +409,11 @@ def __init__(self, type=None, title=None, **kwargs): super(Resource, self).__init__(**kwargs) - if isinstance(type, basestring): + if isinstance(type, str): self.set_resource_type(type) if title is not None: - if isinstance(title, basestring): + if isinstance(title, str): self.title = atom.data.Title(text=title) else: self.title = title --- ./src/gdata/docs/client.py (original) +++ ./src/gdata/docs/client.py (refactored) @@ -21,7 +21,7 @@ import copy import mimetypes import re -import urllib +import urllib.request, urllib.parse, urllib.error import atom.data import atom.http_core import gdata.client @@ -60,7 +60,7 @@ Result of super(DocsClient, self).request(). """ if self.xoauth_requestor_id is not NRefactoringTool: No changes to ./src/gdata/docs/__init__.py RefactoringTool: No changes to ./src/gdata/data.py RefactoringTool: Refactored ./src/gdata/core.py RefactoringTool: No changes to ./src/gdata/contentforshopping/data.py RefactoringTool: Refactored ./src/gdata/contentforshopping/client.py one and uri is not None: - if isinstance(uri, (str, unicode)): + if isinstance(uri, str): uri = atom.http_core.Uri.parse_uri(uri) uri.path.replace('/default', '/%s' % self.xoauth_requestor_id) return super(DocsClient, self).request(method=method, uri=uri, **kwargs) @@ -137,7 +137,7 @@ if uri is None: uri = RESOURCE_FEED_URI - if isinstance(uri, basestring): + if isinstance(uri, str): uri = atom.http_core.Uri.parse_uri(uri) # Add max-results param if it wasn't included in the uri. @@ -177,7 +177,7 @@ if uri is None: uri = RESOURCE_FEED_URI - if isinstance(uri, basestring): + if isinstance(uri, str): uri = atom.http_core.Uri.parse_uri(uri) if show_root is not None: @@ -238,7 +238,7 @@ Returns: gdata.docs.data.Resource representing the retrieved resource. """ - if isinstance(uri, basestring): + if isinstance(uri, str): uri = atom.http_core.Uri.parse_uri(uri) if show_root is not None: uri.query['showroot'] = str(show_root).lower() @@ -398,13 +398,13 @@ uri = base_uri.replace('&', '&') if extra_params is not None: if 'exportFormat' in extra_params and '/Export?' not in uri and '/export?' not in uri: - raise gdata.client.Error, ('This entry type cannot be exported ' + raise gdata.client.Error('This entry type cannot be exported ' 'as a different format.') if 'gid' in extra_params and uri.find('spreadsheets') == -1: - raise gdata.client.Error, 'gid param is not valid for this resource type.' - - uri += '&' + urllib.urlencode(extra_params) + raise gdata.client.Error('gid param is not valid for this resource type.') + + uri += '&' + urllib.parse.urlencode(extra_params) return uri def _get_content(self, uri, extra_params=None, auth_token=None, **kwargs): @@ -445,9 +445,9 @@ server_response = self.request( 'GET', uri, auth_token=token, **kwargs) if server_response.status != 200: - raise gdata.client.RequestError, {'status': server_response.status, + raise gdata.client.RequestError({'status': server_response.status, 'reason': server_response.reason, - 'body': server_response.read()} + 'body': server_response.read()}) return server_response.read() def _download_file(self, uri, file_path, **kwargs): @@ -466,7 +466,7 @@ f = open(file_path, 'wb') try: f.write(self._get_content(uri, **kwargs)) - except gdata.client.RequestError, e: + except gdata.client.RequestError as e: f.close() raise e f.flush() @@ -518,7 +518,7 @@ for current_collection in entry.InCollections(): uri = '%s/contents/%s' % ( current_collection.href, - urllib.quote(entry.resource_id.text)) + urllib.parse.quote(entry.resource_id.text)) self.delete(uri, force=True) if collection is not None: --- ./src/gdata/core.py (original) +++ ./src/gdata/core.py (refactored) @@ -51,7 +51,7 @@ # Recursively transform all members of the dict. # When converting a dict, we do not convert _name items into private # Jsonc members. - for key, value in x.iteritems(): + for key, value in x.items(): jsonc_obj._dict[key] = _convert_to_jsonc(value) return jsonc_obj elif isinstance(x, list): @@ -112,7 +112,7 @@ if isinstance(jsonc_obj, Jsonc): plain = {} - for key, value in jsonc_obj._dict.iteritems(): + for key, value in jsonc_obj._dict.items(): plain[key] = _convert_to_object(value) return plain elif isinstance(jsonc_obj, list): @@ -232,7 +232,7 @@ def __init__(self, _dict=None, **kwargs): json = _dict or {} - for key, value in kwargs.iteritems(): + for key, value in kwargs.items(): if key.startswith('_'): object.__setattr__(self, key, value) else: --- ./src/gdata/contentforshoppRefactoringTool: No changes to ./src/gdata/contentforshopping/__init__.py RefactoringTool: Refactored ./src/gdata/contacts/client.py RefactoringTool: No changes to ./src/gdata/contacts/service.py RefactoringTool: No changes to ./src/gdata/contacts/data.py RefactoringTool: No changes to ./src/gdata/contacts/__init__.py RefactoringTool: No changes to ./src/gdata/codesearch/service.py RefactoringTool: No changes to ./src/gdata/codesearch/__init__.py RefactoringTool: Refactored ./src/gdata/client.py RefactoringTool: No changes to ./src/gdata/calendar_resource/data.py RefactoringTool: Refactored ./src/gdata/calendar_resource/client.py RefactoringTool: Refactored ./src/gdata/calendar/service.py ing/client.py (original) +++ ./src/gdata/contentforshopping/client.py (refactored) @@ -21,7 +21,7 @@ __author__ = 'afshar (Ali Afshar), dhermes (Daniel Hermes)' -import urllib +import urllib.request, urllib.parse, urllib.error import atom.data import gdata.client @@ -78,7 +78,7 @@ segments = [self.cfs_uri, self.cfs_api_version, account_id, resource] if use_projection: segments.append(CFS_PROJECTION) - segments.extend(urllib.quote(value) for value in path) + segments.extend(urllib.parse.quote(value) for value in path) result = '/'.join(segments) request_params = [] --- ./src/gdata/contacts/client.py (original) +++ ./src/gdata/contacts/client.py (refactored) @@ -160,7 +160,7 @@ for link in calendar_link: if not isinstance(link, gdata.contacts.data.CalendarLink): if type(link) is not DictionaryType: - raise TypeError, "calendar_link Requires dictionary not %s" % type(link) + raise TypeError("calendar_link Requires dictionary not %s" % type(link)) link = gdata.contacts.data.CalendarLink( rel=link.get("rel", None), --- ./src/gdata/client.py (original) +++ ./src/gdata/client.py (refactored) @@ -240,7 +240,7 @@ body will be converted to the class using atom.core.parse. """ - if isinstance(uri, (str, unicode)): + if isinstance(uri, str): uri = atom.http_core.Uri.parse_uri(uri) # Add the gsession ID to the URL to prevent further redirects. @@ -742,7 +742,7 @@ # If the user passes in a URL, just delete directly, may not work as # the service might require an ETag. - if isinstance(entry_or_uri, (str, unicode, atom.http_core.Uri)): + if isinstance(entry_or_uri, (str, atom.http_core.Uri)): return self.request(method='DELETE', uri=entry_or_uri, http_request=http_request, auth_token=auth_token, **kwargs) @@ -1037,7 +1037,7 @@ http_request=http_request, desired_class=self.desired_class) return response - except RequestError, error: + except RequestError as error: if error.status == 308: return None else: @@ -1183,7 +1183,7 @@ else: raise error_from_response( '%s returned by server' % response.status, response, RequestError) - except RequestError, error: + except RequestError as error: if error.status == 308: for pair in error.headers: if pair[0].capitalize() == 'Range': --- ./src/gdata/calendar_resource/client.py (original) +++ ./src/gdata/calendar_resource/client.py (refactored) @@ -28,7 +28,7 @@ import gdata.calendar_resource.data import gdata.client -import urllib +import urllib.request, urllib.parse, urllib.error # Feed URI template. This must end with a / @@ -86,7 +86,7 @@ if resource_id: uri += resource_id if params: - uri += '?' + urllib.urlencode(params) + uri += '?' + urllib.parse.urlencode(params) return uri MakeResourceFeedUri = make_resource_feed_uri --- ./src/gdata/calendar/service.py (original) +++ ./src/gdata/calendar/service.py (refactored) @@ -27,7 +27,7 @@ __author__ = 'api.vli (Vivian Li)' -import urllib +import urllib.request, urllib.parse, urllib.error import gdata import atom.service import gdata.service @@ -451,13 +451,13 @@ text_query=None, params=None, categories=None): gdata.service.Query.__init__(self, feed='http://www.google.com/calendar/feeds/%s/%s/%s' % ( - urllib.quote(user), - urllib.quote(visibility), - urllib.quote(projection)), + urllib.parse.quote(user), + urllib.parse.quote(visibility), + urllib.parse.quote(projection)), text_query=text_query, params=params, categories=categories) def _GetStartMin(self): - if 'start-min' in self.keys(): + if 'start-min' in list(self.keys()): rRefactoringTool: No changes to ./src/gdata/calendar/data.py RefactoringTool: Refactored ./src/gdata/calendar/client.py RefactoringTool: Refactored ./src/gdata/calendar/__init__.py eturn self['start-min'] else: return None @@ -469,7 +469,7 @@ doc="""The start-min query parameter""") def _GetStartMax(self): - if 'start-max' in self.keys(): + if 'start-max' in list(self.keys()): return self['start-max'] else: return None @@ -481,21 +481,21 @@ doc="""The start-max query parameter""") def _GetOrderBy(self): - if 'orderby' in self.keys(): + if 'orderby' in list(self.keys()): return self['orderby'] else: return None def _SetOrderBy(self, val): if val is not 'lastmodified' and val is not 'starttime': - raise Error, "Order By must be either 'lastmodified' or 'starttime'" + raise Error("Order By must be either 'lastmodified' or 'starttime'") self['orderby'] = val orderby = property(_GetOrderBy, _SetOrderBy, doc="""The orderby query parameter""") def _GetSortOrder(self): - if 'sortorder' in self.keys(): + if 'sortorder' in list(self.keys()): return self['sortorder'] else: return None @@ -504,15 +504,15 @@ if (val is not 'ascending' and val is not 'descending' and val is not 'a' and val is not 'd' and val is not 'ascend' and val is not 'descend'): - raise Error, "Sort order must be either ascending, ascend, " + ( - "a or descending, descend, or d") + raise Error("Sort order must be either ascending, ascend, " + ( + "a or descending, descend, or d")) self['sortorder'] = val sortorder = property(_GetSortOrder, _SetSortOrder, doc="""The sortorder query parameter""") def _GetSingleEvents(self): - if 'singleevents' in self.keys(): + if 'singleevents' in list(self.keys()): return self['singleevents'] else: return None @@ -524,7 +524,7 @@ doc="""The singleevents query parameter""") def _GetFutureEvents(self): - if 'futureevents' in self.keys(): + if 'futureevents' in list(self.keys()): return self['futureevents'] else: return None @@ -536,7 +536,7 @@ doc="""The futureevents query parameter""") def _GetRecurrenceExpansionStart(self): - if 'recurrence-expansion-start' in self.keys(): + if 'recurrence-expansion-start' in list(self.keys()): return self['recurrence-expansion-start'] else: return None @@ -549,7 +549,7 @@ doc="""The recurrence-expansion-start query parameter""") def _GetRecurrenceExpansionEnd(self): - if 'recurrence-expansion-end' in self.keys(): + if 'recurrence-expansion-end' in list(self.keys()): return self['recurrence-expansion-end'] else: return None @@ -565,7 +565,7 @@ self['ctz'] = val def _GetTimezone(self): - if 'ctz' in self.keys(): + if 'ctz' in list(self.keys()): return self['ctz'] else: return None --- ./src/gdata/calendar/client.py (original) +++ ./src/gdata/calendar/client.py (refactored) @@ -28,7 +28,7 @@ __author__ = 'alainv (Alain Vongsouvanh)' -import urllib +import urllib.request, urllib.parse, urllib.error import gdata.client import gdata.calendar.data import atom.data --- ./src/gdata/calendar/__init__.py (original) +++ ./src/gdata/calendar/__init__.py (refactored) @@ -336,7 +336,7 @@ self.extension_attributes = extension_attributes or {} def findKey(self, value): - res=[item[0] for item in self.enum_map.items() if item[1] == value] + res=[item[0] for item in list(self.enum_map.items()) if item[1] == value] if res is None or len(res) == 0: return None return res[0] @@ -347,7 +347,7 @@ self.value = self.enum_map[value] return # Find the attribute in this class's list of attributes. - if self.__class__._attributes.has_key(attribute): + if attribute in self.__class__._attributes: # Find the member of this class which corresponds to the XML attribute # (lookup in current_class._attributes) and set this member to the # desired value (using self.__dict__). @@ -363,7 +363,7 @@ # This uses the class's _chRefactoringTool: Refactored ./src/gdata/books/service.py RefactoringTool: No changes to ./src/gdata/books/data.py RefactoringTool: No changes to ./src/gdata/books/__init__.py RefactoringTool: No changes to ./src/gdata/blogger/service.py RefactoringTool: Refactored ./src/gdata/blogger/data.py RefactoringTool: Refactored ./src/gdata/blogger/client.py RefactoringTool: No changes to ./src/gdata/blogger/__init__.py RefactoringTool: Refactored ./src/gdata/auth.py ildren dictionary to find the members which # should become XML child nodes. member_node_names = [values[0] for tag, values in - self.__class__._children.iteritems()] + self.__class__._children.items()] for member_name in member_node_names: member = getattr(self, member_name) if member is None: @@ -378,7 +378,7 @@ if key is not None: tree.attrib[self.attrib_name]=key # Convert the members of this class which are XML attributes. - for xml_attribute, member_name in self.__class__._attributes.iteritems(): + for xml_attribute, member_name in self.__class__._attributes.items(): member = getattr(self, member_name) if member is not None: tree.attrib[xml_attribute] = member @@ -939,7 +939,7 @@ child_tree)) return # Find the element's tag in this class's list of child members - if self.__class__._children.has_key(child_tree.tag): + if child_tree.tag in self.__class__._children: member_name = self.__class__._children[child_tree.tag][0] member_class = self.__class__._children[child_tree.tag][1] # If the class member is supposed to contain a list, make sure the --- ./src/gdata/books/service.py (original) +++ ./src/gdata/books/service.py (refactored) @@ -124,7 +124,7 @@ upper bound is exclusive """ - for k, v in kwargs.items(): + for k, v in list(kwargs.items()): if not v: continue k = k.lower() --- ./src/gdata/blogger/data.py (original) +++ ./src/gdata/blogger/data.py (refactored) @@ -22,7 +22,7 @@ import re -import urlparse +import urllib.parse import atom.core import gdata.data @@ -75,7 +75,7 @@ """ for link in self.link: if link.rel == 'alternate': - return urlparse.urlparse(link.href)[1].split(".", 1)[0] + return urllib.parse.urlparse(link.href)[1].split(".", 1)[0] return None GetBlogName = get_blog_name --- ./src/gdata/blogger/client.py (original) +++ ./src/gdata/blogger/client.py (refactored) @@ -145,7 +145,7 @@ Update = update def delete(self, entry_or_uri, auth_token=None, **kwargs): - if isinstance(entry_or_uri, (str, unicode, atom.http_core.Uri)): + if isinstance(entry_or_uri, (str, atom.http_core.Uri)): return gdata.client.GDClient.delete(self, entry_or_uri, auth_token=auth_token, **kwargs) # The Blogger API does not currently support ETags, so for now remove --- ./src/gdata/auth.py (original) +++ ./src/gdata/auth.py (refactored) @@ -21,7 +21,7 @@ import re import time import types -import urllib +import urllib.request, urllib.parse, urllib.error import atom.http_interface import atom.token_store import atom.url @@ -257,7 +257,7 @@ callback_url += '&' else: callback_url += '?' - callback_url += urllib.urlencode({scopes_param_prefix:scopes}) + callback_url += urllib.parse.urlencode({scopes_param_prefix:scopes}) oauth_token = oauth.OAuthToken(request_token.key, request_token.secret) oauth_request = oauth.OAuthRequest.from_token_and_callback( token=oauth_token, callback=callback_url, @@ -336,7 +336,7 @@ else: session = 0 - request_params = urllib.urlencode({'next': next, 'scope': scope, + request_params = urllib.parse.urlencode({'next': next, 'scope': scope, 'secure': secure, 'session': session, 'hd': domain}) if request_url.find('?') == -1: @@ -385,12 +385,12 @@ An atom.url.Url which the user's browser should be directed to in order to authorize this application to access their information. """ - if isinstance(next, (str, unicode)): + if isinstance(next, str): next = atom.url.parse_url(next) scopes_string = ' '.join([str(scope) for scope in scopes]) next.params[scopes_param_prefix] = scopes_string - if isinstancRefactoringTool: No changes to ./src/gdata/apps_property.py RefactoringTool: Refactored ./src/gdata/apps/service.py e(request_url, (str, unicode)): + if isinstance(request_url, str): request_url = atom.url.parse_url(request_url) request_url.params['next'] = str(next) request_url.params['scope'] = scopes_string @@ -465,7 +465,7 @@ the AuthSubToken defaults to being valid for no scopes. If there was no 'token' parameter in the URL, this function returns None. """ - if isinstance(url, (str, unicode)): + if isinstance(url, str): url = atom.url.parse_url(url) if 'token' not in url.params: return None @@ -551,7 +551,7 @@ the OAuthToken defaults to being valid for no scopes. If there was no 'oauth_token' parameter in the URL, this function returns None. """ - if isinstance(url, (str, unicode)): + if isinstance(url, str): url = atom.url.parse_url(url) if 'oauth_token' not in url.params: return None @@ -734,12 +734,12 @@ def valid_for_scope(self, url): """Tells the caller if the token authorizes access to the desired URL. """ - if isinstance(url, (str, unicode)): + if isinstance(url, str): url = atom.url.parse_url(url) for scope in self.scopes: if scope == atom.token_store.SCOPE_ALL: return True - if isinstance(scope, (str, unicode)): + if isinstance(scope, str): scope = atom.url.parse_url(scope) if scope == url: return True @@ -804,7 +804,7 @@ oauth_token_secret=[1]. If both are absent, it returns None. """ if self.key and self.secret: - return urllib.urlencode({'oauth_token': self.key, + return urllib.parse.urlencode({'oauth_token': self.key, 'oauth_token_secret': self.secret}) elif self.key: return 'oauth_token=%s' % self.key @@ -841,7 +841,7 @@ dict Header to be sent with every subsequent request after authentication. """ - if isinstance(http_url, types.StringTypes): + if isinstance(http_url, (str,)): http_url = atom.url.parse_url(http_url) header = None token = None @@ -868,12 +868,12 @@ return http_client.request(operation, url, data=data, headers=headers) def valid_for_scope(self, url): - if isinstance(url, (str, unicode)): + if isinstance(url, str): url = atom.url.parse_url(url) for scope in self.scopes: if scope == atom.token_store.SCOPE_ALL: return True - if isinstance(scope, (str, unicode)): + if isinstance(scope, str): scope = atom.url.parse_url(scope) if scope == url: return True --- ./src/gdata/apps/service.py (original) +++ ./src/gdata/apps/service.py (refactored) @@ -25,7 +25,7 @@ from xml.etree import ElementTree except ImportError: from elementtree import ElementTree -import urllib +import urllib.request, urllib.parse, urllib.error import gdata import atom.service import gdata.service @@ -127,7 +127,7 @@ try: return gdata.apps.EmailListFeedFromString(str(self.GetWithRetries( uri, num_retries=num_retries, delay=delay, backoff=backoff))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def GetGeneratorForAllEmailLists( @@ -156,7 +156,7 @@ self._baseURL(), API_VER, list_name) try: return self.Get(uri, converter=gdata.apps.EmailListEntryFromString) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def RetrieveEmailLists(self, recipient): @@ -166,7 +166,7 @@ self._baseURL(), API_VER, recipient) try: ret = gdata.apps.EmailListFeedFromString(str(self.Get(uri))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) # pagination @@ -180,7 +180,7 @@ self._baseURL(), API_VER, list_name, recipient) try: self.Delete(uri) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def RetrievePageOfRecipients(self, list_name, start_recipient=None, @@ -198,7 +198,7 @@ return gdata.apps.EmailListRecipientFeedFromString(str( self.GetWithRetries( uri, num_retries=num_retries, delay=delay, backoff=backoff))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def GetGeneratorForAllRecipients( @@ -232,7 +232,7 @@ try: return gdata.apps.EmailListRecipientEntryFromString( str(self.Post(recipient_entry, uri))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def DeleteEmailList(self, list_name): @@ -241,7 +241,7 @@ uri = "%s/emailList/%s/%s" % (self._baseURL(), API_VER, list_name) try: self.Delete(uri) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def CreateEmailList(self, list_name): @@ -253,7 +253,7 @@ try: return gdata.apps.EmailListEntryFromString( str(self.Post(email_list_entry, uri))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def DeleteNickname(self, nickname): @@ -262,7 +262,7 @@ uri = "%s/nickname/%s/%s" % (self._baseURL(), API_VER, nickname) try: self.Delete(uri) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def RetrievePageOfNicknames(self, start_nickname=None, @@ -277,7 +277,7 @@ try: return gdata.apps.NicknameFeedFromString(str(self.GetWithRetries( uri, num_retries=num_retries, delay=delay, backoff=backoff))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def GetGeneratorForAllNicknames( @@ -307,7 +307,7 @@ try: first_page = gdata.apps.NicknameFeedFromString(str(self.GetWithRetries( uri, num_retries=num_retries, delay=delay, backoff=backoff))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) return self.GetGeneratorFromLinkFinder( first_page, gdata.apps.NicknameFeedFromString, num_retries=num_retries, @@ -319,7 +319,7 @@ uri = "%s/nickname/%s?username=%s" % (self._baseURL(), API_VER, user_name) try: ret = gdata.apps.NicknameFeedFromString(str(self.Get(uri))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) # pagination @@ -339,7 +339,7 @@ uri = "%s/nickname/%s/%s" % (self._baseURL(), API_VER, nickname) try: return gdata.apps.NicknameEntryFromString(str(self.Get(uri))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def CreateNickname(self, user_name, nickname): @@ -353,7 +353,7 @@ try: return gdata.apps.NicknameEntryFromString( str(self.Post(nickname_entry, uri))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def DeleteUser(self, user_name): @@ -362,7 +362,7 @@ uri = "%s/user/%s/%s" % (self._baseURL(), API_VER, user_name) try: return self.Delete(uri) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def UpdateUser(self, user_name, user_entry): @@ -371,7 +371,7 @@ uri = "%s/user/%s/%s" % (self._baseURL(), API_VER, user_name) try: return gdata.apps.UserEntryFromString(str(self.Put(user_entry, uri))) - except gdata.service.RequestError, e: + except gRefactoringTool: No changes to ./src/gdata/apps/organization/service.py RefactoringTool: No changes to ./src/gdata/apps/organization/data.py RefactoringTool: Refactored ./src/gdata/apps/organization/client.py RefactoringTool: No changes to ./src/gdata/apps/multidomain/data.py RefactoringTool: Refactored ./src/gdata/apps/multidomain/client.py data.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def CreateUser(self, user_name, family_name, given_name, password, @@ -393,7 +393,7 @@ try: return gdata.apps.UserEntryFromString(str(self.Post(user_entry, uri))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def SuspendUser(self, user_name): @@ -423,7 +423,7 @@ uri = "%s/user/%s/%s" % (self._baseURL(), API_VER, user_name) try: return gdata.apps.UserEntryFromString(str(self.Get(uri))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def RetrievePageOfUsers(self, start_username=None, @@ -438,7 +438,7 @@ try: return gdata.apps.UserFeedFromString(str(self.GetWithRetries( uri, num_retries=num_retries, delay=delay, backoff=backoff))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def GetGeneratorForAllUsers(self, @@ -487,7 +487,7 @@ def _GetPropertyEntry(self, properties): property_entry = gdata.apps.PropertyEntry() property = [] - for name, value in properties.iteritems(): + for name, value in properties.items(): if name is not None and value is not None: property.append(gdata.apps.Property(name=name, value=value)) property_entry.property = property @@ -502,7 +502,7 @@ def _GetPropertyFeed(self, uri): try: return gdata.apps.PropertyFeedFromString(str(self.Get(uri))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise gdata.apps.service.AppsForYourDomainException(e.args[0]) def _GetPropertiesList(self, uri): @@ -519,7 +519,7 @@ try: return self._PropertyEntry2Dict(gdata.apps.PropertyEntryFromString( str(self.Get(uri)))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise gdata.apps.service.AppsForYourDomainException(e.args[0]) def _PostProperties(self, uri, properties): @@ -527,7 +527,7 @@ try: return self._PropertyEntry2Dict(gdata.apps.PropertyEntryFromString( str(self.Post(property_entry, uri)))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise gdata.apps.service.AppsForYourDomainException(e.args[0]) def _PutProperties(self, uri, properties): @@ -535,13 +535,13 @@ try: return self._PropertyEntry2Dict(gdata.apps.PropertyEntryFromString( str(self.Put(property_entry, uri)))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise gdata.apps.service.AppsForYourDomainException(e.args[0]) def _DeleteProperties(self, uri): try: self.Delete(uri) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise gdata.apps.service.AppsForYourDomainException(e.args[0]) --- ./src/gdata/apps/organization/client.py (original) +++ ./src/gdata/apps/organization/client.py (refactored) @@ -27,7 +27,7 @@ __author__ = 'Gunjan Sharma ' -import urllib +import urllib.request, urllib.parse, urllib.error import gdata.apps.organization.data import gdata.client @@ -99,7 +99,7 @@ if org_unit_path_or_user_email: uri += '/' + org_unit_path_or_user_email if params: - uri += '?' + urllib.urlencode(params) + uri += '?' + urllib.parse.urlencode(params) return uri MakeOrganizationUnitProvisioningUri = make_organization_unit_provisioning_uri --- ./src/gdata/apps/multidomain/client.py (original) +++ ./src/gdata/apps/multidomain/client.py (refactored) @@ -26,7 +26,7 @@ __author__ = 'Claudio Cherubino ' -import urllib +import urllib.request, urllib.parse, urllib.error import gdata.apps.multidomain.data import gdata.client @@ -97,7 +97,7 @@ if email: RefactoringTool: Refactored ./src/gdata/apps/migration/service.py RefactoringTool: No changes to ./src/gdata/apps/migration/__init__.py RefactoringTool: Refactored ./src/gdata/apps/groups/service.py uri += '/' + email if params: - uri += '?' + urllib.urlencode(params) + uri += '?' + urllib.parse.urlencode(params) return uri MakeMultidomainProvisioningUri = make_multidomain_provisioning_uri --- ./src/gdata/apps/migration/service.py (original) +++ ./src/gdata/apps/migration/service.py (refactored) @@ -76,14 +76,12 @@ mail_entry.rfc822_msg = migration.Rfc822Msg(text=(base64.b64encode( mail_message))) mail_entry.rfc822_msg.encoding = 'base64' - mail_entry.mail_item_property = map( - lambda x: migration.MailItemProperty(value=x), mail_item_properties) - mail_entry.label = map(lambda x: migration.Label(label_name=x), - mail_labels) + mail_entry.mail_item_property = [migration.MailItemProperty(value=x) for x in mail_item_properties] + mail_entry.label = [migration.Label(label_name=x) for x in mail_labels] try: return migration.MailEntryFromString(str(self.Post(mail_entry, uri))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: # Store the number of failed imports when importing several at a time self.exceptions += 1 raise gdata.apps.service.AppsForYourDomainException(e.args[0]) @@ -107,10 +105,8 @@ mail_entry.rfc822_msg = migration.Rfc822Msg(text=(base64.b64encode( mail_message))) mail_entry.rfc822_msg.encoding = 'base64' - mail_entry.mail_item_property = map( - lambda x: migration.MailItemProperty(value=x), mail_item_properties) - mail_entry.label = map(lambda x: migration.Label(label_name=x), - mail_labels) + mail_entry.mail_item_property = [migration.MailItemProperty(value=x) for x in mail_item_properties] + mail_entry.label = [migration.Label(label_name=x) for x in mail_labels] self.mail_batch.AddBatchEntry(mail_entry) @@ -136,7 +132,7 @@ try: self.result = self.Post(self.mail_batch, uri, converter=migration.BatchMailEventFeedFromString) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise gdata.apps.service.AppsForYourDomainException(e.args[0]) self.mail_batch = migration.BatchMailEventFeed() @@ -212,7 +208,7 @@ batch_min = batch_max self.mail_entries = [] - except Exception, e: + except Exception as e: raise Exception(e.args[0]) else: return num_entries - self.exceptions --- ./src/gdata/apps/groups/service.py (original) +++ ./src/gdata/apps/groups/service.py (refactored) @@ -22,7 +22,7 @@ __author__ = 'google-apps-apis@googlegroups.com' -import urllib +import urllib.request, urllib.parse, urllib.error import gdata.apps import gdata.apps.service import gdata.service @@ -59,16 +59,16 @@ return GROUP_ID_URL % (domain, group_id) elif member_id != '': if direct_only: - return GROUP_MEMBER_DIRECT_URL % (domain, urllib.quote_plus(member_id), + return GROUP_MEMBER_DIRECT_URL % (domain, urllib.parse.quote_plus(member_id), self._Bool2Str(direct_only)) else: - return GROUP_MEMBER_URL % (domain, urllib.quote_plus(member_id)) + return GROUP_MEMBER_URL % (domain, urllib.parse.quote_plus(member_id)) else: return BASE_URL % (domain) if service_type == 'member': if member_id != '' and is_existed: - return MEMBER_ID_URL % (domain, group_id, urllib.quote_plus(member_id)) + return MEMBER_ID_URL % (domain, group_id, urllib.parse.quote_plus(member_id)) elif suspended_users: return MEMBER_WITH_SUSPENDED_URL % (domain, group_id, self._Bool2Str(suspended_users)) @@ -77,7 +77,7 @@ if service_type == 'owner': if owner_email != '' and is_existed: - return OWNER_ID_URL % (domain, group_id, urllib.quote_plus(owner_email)) + return OWNER_ID_URL % (domain, group_id, urllib.parse.quote_plus(owner_email)) elif suspendedRefactoringTool: No changes to ./src/gdata/apps/groups/data.py RefactoringTool: Refactored ./src/gdata/apps/groups/client.py RefactoringTool: Refactored ./src/gdata/apps/emailsettings/service.py RefactoringTool: No changes to ./src/gdata/apps/emailsettings/data.py RefactoringTool: Refactored ./src/gdata/apps/emailsettings/client.py RefactoringTool: No changes to ./src/gdata/apps/data.py RefactoringTool: No changes to ./src/gdata/apps/client.py RefactoringTool: Refactored ./src/gdata/apps/audit/service.py _users: return OWNER_WITH_SUSPENDED_URL % (domain, group_id, self._Bool2Str(suspended_users)) @@ -93,7 +93,7 @@ try: self._GetProperties(uri) return True - except gdata.apps.service.AppsForYourDomainException, e: + except gdata.apps.service.AppsForYourDomainException as e: if e.error_code == gdata.apps.service.ENTITY_DOES_NOT_EXIST: return False else: --- ./src/gdata/apps/groups/client.py (original) +++ ./src/gdata/apps/groups/client.py (refactored) @@ -25,7 +25,7 @@ __author__ = 'Shraddha gupta ' -import urllib +import urllib.request, urllib.parse, urllib.error import gdata.apps.groups.data import gdata.client @@ -95,7 +95,7 @@ if member_id: uri += '/' + member_id if params: - uri += '?' + urllib.urlencode(params) + uri += '?' + urllib.parse.urlencode(params) return uri MakeGroupProvisioningUri = make_group_provisioning_uri --- ./src/gdata/apps/emailsettings/service.py (original) +++ ./src/gdata/apps/emailsettings/service.py (refactored) @@ -235,7 +235,7 @@ return self._PutProperties(uri, properties) def UpdateGeneral(self, username, page_size=None, shortcuts=None, arrows=None, - snippets=None, unicode=None): + snippets=None, str=None): """Update general settings. Args: @@ -259,6 +259,6 @@ properties['arrows'] = gdata.apps.service._bool2str(arrows) if snippets != None: properties['snippets'] = gdata.apps.service._bool2str(snippets) - if unicode != None: - properties['unicode'] = gdata.apps.service._bool2str(unicode) - return self._PutProperties(uri, properties) + if str != None: + properties['unicode'] = gdata.apps.service._bool2str(str) + return self._PutProperties(uri, properties) --- ./src/gdata/apps/emailsettings/client.py (original) +++ ./src/gdata/apps/emailsettings/client.py (refactored) @@ -28,7 +28,7 @@ __author__ = 'Claudio Cherubino ' -import urllib +import urllib.request, urllib.parse, urllib.error import gdata.apps.emailsettings.data import gdata.client @@ -181,7 +181,7 @@ """ uri = self.MakeEmailSettingsUri(username=username, setting_id=SETTING_ID_LABEL) - uri = '/'.join([uri, urllib.quote_plus(label)]) + uri = '/'.join([uri, urllib.parse.quote_plus(label)]) return self.delete(uri, **kwargs) DeleteLabel = delete_label --- ./src/gdata/apps/audit/service.py (original) +++ ./src/gdata/apps/audit/service.py (refactored) @@ -131,7 +131,7 @@ uri = self._serviceUrl('mail/monitor', user=source_user+'/'+destination_user) try: return self._DeleteProperties(uri) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def createAccountInformationRequest(self, user): @@ -148,7 +148,7 @@ #XML Body is left empty try: return self._PostProperties(uri, properties) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def getAccountInformationRequestStatus(self, user, request_id): @@ -164,7 +164,7 @@ uri = self._serviceUrl('account', user=user+'/'+request_id) try: return self._GetProperties(uri) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def getAllAccountInformationRequestsStatus(self): @@ -195,7 +195,7 @@ uri = self._serviceUrl('account', user=user+'/'+request_id) try: return self._DeleteProperties(uri) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def createMailboxExportRequest(self, user, begin_date=None, end_date=None, include_deleted=False, search_query=None, headers_only=False): @@ -242,7 +242,7 @@ uri = self._serviceRefactoringTool: No changes to ./src/gdata/apps/apps_property_entry.py RefactoringTool: Refactored ./src/gdata/apps/adminsettings/service.py RefactoringTool: No changes to ./src/gdata/apps/__init__.py RefactoringTool: Refactored ./src/gdata/analytics/service.py RefactoringTool: No changes to ./src/gdata/analytics/data.py RefactoringTool: No changes to ./src/gdata/analytics/client.py RefactoringTool: No changes to ./src/gdata/analytics/__init__.py RefactoringTool: Refactored ./src/gdata/alt/appengine.py Url('mail/export', user=user+'/'+request_id) try: return self._GetProperties(uri) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def getAllMailboxExportRequestsStatus(self): @@ -273,5 +273,5 @@ uri = self._serviceUrl('mail/export', user=user+'/'+request_id) try: return self._DeleteProperties(uri) - except gdata.service.RequestError, e: - raise AppsForYourDomainException(e.args[0]) + except gdata.service.RequestError as e: + raise AppsForYourDomainException(e.args[0]) --- ./src/gdata/apps/adminsettings/service.py (original) +++ ./src/gdata/apps/adminsettings/service.py (refactored) @@ -48,7 +48,7 @@ uri = self._serviceUrl(location) try: return self._GetProperties(uri) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def GetDefaultLanguage(self): @@ -232,9 +232,9 @@ Returns: binary image file""" - import urllib + import urllib.request, urllib.parse, urllib.error url = 'http://www.google.com/a/cpanel/'+self.domain+'/images/logo.gif' - response = urllib.urlopen(url) + response = urllib.request.urlopen(url) return response.read() def UpdateDomainLogo(self, logoImage): @@ -414,7 +414,7 @@ uri = self._serviceUrl('email/gateway') try: return self._GetProperties(uri) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) except TypeError: #if no outbound gateway is set, we get a TypeError, --- ./src/gdata/analytics/service.py (original) +++ ./src/gdata/analytics/service.py (refactored) @@ -31,7 +31,7 @@ __author__ = 'api.suryasev (Sal Uryasev)' -import urllib +import urllib.request, urllib.parse, urllib.error import atom import gdata.service import gdata.analytics @@ -275,8 +275,8 @@ """ old_feed = self.feed self.feed = '/'.join([old_feed]) + '?' + \ - urllib.urlencode(dict([(key, value) for key, value in \ - self.elements.iteritems() if value])) + urllib.parse.urlencode(dict([(key, value) for key, value in \ + self.elements.items() if value])) new_feed = gdata.service.Query.ToUri(self) self.feed = old_feed return new_feed --- ./src/gdata/alt/appengine.py (original) +++ ./src/gdata/alt/appengine.py (refactored) @@ -32,7 +32,7 @@ __author__ = 'api.jscudder (Jeff Scudder)' -import StringIO +import io import pickle import atom.http_interface import atom.token_store @@ -173,7 +173,7 @@ """ def __init__(self, urlfetch_response): - self.body = StringIO.StringIO(urlfetch_response.content) + self.body = io.StringIO(urlfetch_response.content) self.headers = urlfetch_response.headers self.status = urlfetch_response.status_code self.reason = '' @@ -185,7 +185,7 @@ return self.body.read(length) def getheader(self, name): - if not self.headers.has_key(name): + if name not in self.headers: return self.headers[name.lower()] return self.headers[name] @@ -234,7 +234,7 @@ """ if url is None: return None - if isinstance(url, (str, unicode)): + if isinstance(url, str): url = atom.url.parse_url(url) tokens = load_auth_tokens(self.user) if url in tokens: @@ -244,7 +244,7 @@ else: del tokens[url] save_auth_tokens(tokens, self.user) - for scope, token in tokens.iteritems(): + for scope, token in tokens.items(): if token.valid_for_scope(url): return token return atom.http_interface.GenericToken() @@ -259,7 +259,7 @@ token_found = False scopes_to_delete = [] tokens = load_auth_tokens(self.user) - for scope, stored_token in tokens.iteritems(): + for scope, stored_token in tokens.items(): if stored_token == token: scopes_to_delete.append(scope) token_found = TruRefactoringTool: No changes to ./src/gdata/alt/app_engine.py RefactoringTool: No changes to ./src/gdata/alt/__init__.py RefactoringTool: No changes to ./src/gdata/acl/data.py RefactoringTool: No changes to ./src/gdata/__init__.py RefactoringTool: Refactored ./src/atom/url.py RefactoringTool: Refactored ./src/atom/token_store.py RefactoringTool: Refactored ./src/atom/service.py e --- ./src/atom/url.py (original) +++ ./src/atom/url.py (refactored) @@ -18,8 +18,8 @@ __author__ = 'api.jscudder (Jeff Scudder)' -import urlparse -import urllib +import urllib.parse +import urllib.request, urllib.parse, urllib.error DEFAULT_PROTOCOL = 'http' @@ -32,7 +32,7 @@ This method can accept partial URLs, but it will leave missing members of the Url unset. """ - parts = urlparse.urlparse(url_string) + parts = urllib.parse.urlparse(url_string) url = Url() if parts[0]: url.protocol = parts[0] @@ -49,10 +49,10 @@ for pair in param_pairs: pair_parts = pair.split('=') if len(pair_parts) > 1: - url.params[urllib.unquote_plus(pair_parts[0])] = ( - urllib.unquote_plus(pair_parts[1])) + url.params[urllib.parse.unquote_plus(pair_parts[0])] = ( + urllib.parse.unquote_plus(pair_parts[1])) elif len(pair_parts) == 1: - url.params[urllib.unquote_plus(pair_parts[0])] = None + url.params[urllib.parse.unquote_plus(pair_parts[0])] = None return url class Url(object): @@ -84,13 +84,13 @@ url_parts[2] = self.path if self.params: url_parts[4] = self.get_param_string() - return urlparse.urlunparse(url_parts) + return urllib.parse.urlunparse(url_parts) def get_param_string(self): param_pairs = [] - for key, value in self.params.iteritems(): - param_pairs.append('='.join((urllib.quote_plus(key), - urllib.quote_plus(str(value))))) + for key, value in self.params.items(): + param_pairs.append('='.join((urllib.parse.quote_plus(key), + urllib.parse.quote_plus(str(value))))) return '&'.join(param_pairs) def get_request_uri(self): --- ./src/atom/token_store.py (original) +++ ./src/atom/token_store.py (refactored) @@ -78,7 +78,7 @@ """ if url is None: return None - if isinstance(url, (str, unicode)): + if isinstance(url, str): url = atom.url.parse_url(url) if url in self._tokens: token = self._tokens[url] @@ -86,7 +86,7 @@ return token else: del self._tokens[url] - for scope, token in self._tokens.iteritems(): + for scope, token in self._tokens.items(): if token.valid_for_scope(url): return token return atom.http_interface.GenericToken() @@ -105,7 +105,7 @@ """ token_found = False scopes_to_delete = [] - for scope, stored_token in self._tokens.iteritems(): + for scope, stored_token in self._tokens.items(): if stored_token == token: scopes_to_delete.append(scope) token_found = True --- ./src/atom/service.py (original) +++ ./src/atom/service.py (refactored) @@ -35,8 +35,8 @@ import atom.token_store import os -import httplib -import urllib +import http.client +import urllib.request, urllib.parse, urllib.error import re import base64 import socket @@ -150,7 +150,7 @@ #@atom.v1_deprecated('Please use atom.client.AtomPubClient for requests.') def request(self, operation, url, data=None, headers=None, url_params=None): - if isinstance(url, (str, unicode)): + if isinstance(url, str): if url.startswith('http:') and self.ssl: # Force all requests to be https if self.ssl is True. url = atom.url.parse_url('https:' + url[5:]) @@ -162,7 +162,7 @@ url = atom.url.parse_url(url) if url_params: - for name, value in url_params.iteritems(): + for name, value in url_params.items(): url.params[name] = value all_headers = self.additional_headers.copy() @@ -346,12 +346,12 @@ def valid_for_scope(self, url): """Tells the caller if the token authorizes access to the desired URL. """ - if isinstance(url, (str, unicode)): + if isinstance(url, str): url = atom.url.parse_url(url) for scope in self.scopes: if scope == atom.token_store.SCOPE_ALL: return True - if isinstance(scope, (str, unicode)): + if isinstance(scope, str): scope = atom.url.parse_url(scope) if scope == url: RefactoringTool: Refactored ./src/atom/mock_service.py RefactoringTool: Refactored ./src/atom/mock_http_core.py return True @@ -429,15 +429,15 @@ # Trivial setup for ssl socket. ssl = socket.ssl(p_sock, None, None) - fake_sock = httplib.FakeSocket(p_sock, ssl) + fake_sock = http.client.FakeSocket(p_sock, ssl) # Initalize httplib and replace with the proxy socket. - connection = httplib.HTTPConnection(server) + connection = http.client.HTTPConnection(server) connection.sock=fake_sock full_uri = partial_uri else: - connection = httplib.HTTPSConnection(server, port) + connection = http.client.HTTPSConnection(server, port) full_uri = partial_uri else: @@ -453,14 +453,14 @@ proxy_password = os.environ.get('proxy_password') if proxy_username: UseBasicAuth(service, proxy_username, proxy_password, True) - connection = httplib.HTTPConnection(p_server, p_port) + connection = http.client.HTTPConnection(p_server, p_port) if not full_uri.startswith("http://"): if full_uri.startswith("/"): full_uri = "http://%s%s" % (service.server, full_uri) else: full_uri = "http://%s/%s" % (service.server, full_uri) else: - connection = httplib.HTTPConnection(server, port) + connection = http.client.HTTPConnection(server, port) full_uri = partial_uri return (connection, full_uri) @@ -543,11 +543,11 @@ """ # Choose which function to use when modifying the query and parameters. # Use quote_plus when escape_params is true. - transform_op = [str, urllib.quote_plus][bool(escape_params)] + transform_op = [str, urllib.parse.quote_plus][bool(escape_params)] # Create a list of tuples containing the escaped version of the # parameter-value pairs. parameter_tuples = [(transform_op(param), transform_op(value)) - for param, value in (url_parameters or {}).items()] + for param, value in list((url_parameters or {}).items())] # Turn parameter-value tuples into a list of strings in the form # 'PARAMETER=VALUE'. return ['='.join(x) for x in parameter_tuples] @@ -657,8 +657,8 @@ # If the list of headers does not include a Content-Length, attempt to # calculate it based on the data object. - if (data and not service.additional_headers.has_key('Content-Length') and - not extra_headers.has_key('Content-Length')): + if (data and 'Content-Length' not in service.additional_headers and + 'Content-Length' not in extra_headers): content_length = CalculateDataLength(data) if content_length: extra_headers['Content-Length'] = str(content_length) --- ./src/atom/mock_service.py (original) +++ ./src/atom/mock_service.py (refactored) @@ -168,7 +168,7 @@ def ConcealSecrets(self, conceal_func): """Conceal secret data in this request.""" - if self.extra_headers.has_key('Authorization'): + if 'Authorization' in self.extra_headers: self.extra_headers['Authorization'] = conceal_func( self.extra_headers['Authorization']) --- ./src/atom/mock_http_core.py (original) +++ ./src/atom/mock_http_core.py (refactored) @@ -21,7 +21,7 @@ __author__ = 'j.s@google.com (Jeff Scudder)' -import StringIO +import io import pickle import os.path import tempfile @@ -250,7 +250,7 @@ http_request.headers, http_request._body_parts) def _http_request(self, uri, method, headers=None, body_parts=None): - body = StringIO.StringIO() + body = io.StringIO() response = atom.http_core.HttpResponse(status=200, reason='OK', body=body) if headers is None: response._headers = {} @@ -258,7 +258,7 @@ # Copy headers from the request to the response but convert values to # strings. Server response headers always come in as strings, so an int # should be converted to a corresponding string when echoing. - for header, value in headers.iteritems(): + for header, value in headers.items(): response._headers[header] = str(value) response._headers['Echo-Host'] = '%s:%s' % (uri.host, str(uri.port))RefactoringTool: Refactored ./src/atom/mock_http.py RefactoringTool: Refactored ./src/atom/http_interface.py RefactoringTool: Refactored ./src/atom/http_core.py response._headers['Echo-Uri'] = uri._get_relative_path() --- ./src/atom/mock_http.py (original) +++ ./src/atom/mock_http.py (refactored) @@ -35,7 +35,7 @@ """ def __init__(self, operation, url, data=None, headers=None): self.operation = operation - if isinstance(url, (str, unicode)): + if isinstance(url, str): url = atom.url.parse_url(url) self.url = url self.data = data @@ -112,7 +112,7 @@ If there is no match, a NoRecordingFound error will be raised. """ if self.real_client is None: - if isinstance(url, (str, unicode)): + if isinstance(url, str): url = atom.url.parse_url(url) for recording in self.recordings: if recording[0].operation == operation and recording[0].url == url: --- ./src/atom/http_interface.py (original) +++ ./src/atom/http_interface.py (refactored) @@ -33,7 +33,7 @@ __author__ = 'api.jscudder (Jeff Scudder)' -import StringIO +import io USER_AGENT = '%s GData-Python/2.0.18' @@ -74,7 +74,7 @@ if hasattr(body, 'read'): self._body = body else: - self._body = StringIO.StringIO(body) + self._body = io.StringIO(body) else: self._body = None if status is not None: --- ./src/atom/http_core.py (original) +++ ./src/atom/http_core.py (refactored) @@ -23,10 +23,10 @@ import os -import StringIO -import urlparse -import urllib -import httplib +import io +import urllib.parse +import urllib.request, urllib.parse, urllib.error +import http.client ssl = None try: import ssl @@ -97,7 +97,7 @@ self._body_parts = [] if method is not None: self.method = method - if isinstance(uri, (str, unicode)): + if isinstance(uri, str): uri = Uri.parse_uri(uri) self.uri = uri or Uri() @@ -184,7 +184,7 @@ mime_type: str The MIME type of the form data being sent. Defaults to 'application/x-www-form-urlencoded'. """ - body = urllib.urlencode(form_data) + body = urllib.parse.urlencode(form_data) self.add_body_part(body, mime_type) AddFormInputs = add_form_inputs @@ -206,12 +206,12 @@ """ output = 'HTTP Request\n method: %s\n url: %s\n headers:\n' % ( self.method, str(self.uri)) - for header, value in self.headers.iteritems(): + for header, value in self.headers.items(): output += ' %s: %s\n' % (header, value) output += ' body sections:\n' i = 0 for part in self._body_parts: - if isinstance(part, (str, unicode)): + if isinstance(part, str): output += ' %s: %s\n' % (i, part) else: output += ' %s: \n' % i @@ -260,12 +260,12 @@ def _get_query_string(self): param_pairs = [] - for key, value in self.query.iteritems(): - quoted_key = urllib.quote_plus(str(key)) + for key, value in self.query.items(): + quoted_key = urllib.parse.quote_plus(str(key)) if value is None: param_pairs.append(quoted_key) else: - quoted_value = urllib.quote_plus(str(value)) + quoted_value = urllib.parse.quote_plus(str(value)) param_pairs.append('%s=%s' % (quoted_key, quoted_value)) return '&'.join(param_pairs) @@ -329,7 +329,7 @@ This method can accept partial URIs, but it will leave missing members of the Uri unset. """ - parts = urlparse.urlparse(uri_string) + parts = urllib.parse.urlparse(uri_string) uri = Uri() if parts[0]: uri.scheme = parts[0] @@ -346,10 +346,10 @@ for pair in param_pairs: pair_parts = pair.split('=') if len(pair_parts) > 1: - uri.query[urllib.unquote_plus(pair_parts[0])] = ( - urllib.unquote_plus(pair_parts[1])) + uri.query[urllib.parse.unquote_plus(pair_parts[0])] = ( + urllib.parse.unquote_plus(pair_parts[1])) elif len(pair_parts) == 1: - uri.query[urllib.unquote_plus(pair_parts[0])] = None + uri.query[urllib.parse.unquote_plus(pair_parts[0])] = None return uri parse_uri = staRefactoringTool: Refactored ./src/atom/http.py ticmethod(parse_uri) @@ -378,7 +378,7 @@ if hasattr(body, 'read'): self._body = body else: - self._body = StringIO.StringIO(body) + self._body = io.StringIO(body) def getheader(self, name, default=None): if name in self._headers: @@ -407,7 +407,7 @@ http_response.status, http_response.reason) headers = get_headers(http_response) if isinstance(headers, dict): - for header, value in headers.iteritems(): + for header, value in headers.items(): output += ' %s: %s\n' % (header, value) else: for pair in headers: @@ -436,14 +436,14 @@ connection = None if uri.scheme == 'https': if not uri.port: - connection = httplib.HTTPSConnection(uri.host) + connection = http.client.HTTPSConnection(uri.host) else: - connection = httplib.HTTPSConnection(uri.host, int(uri.port)) + connection = http.client.HTTPSConnection(uri.host, int(uri.port)) else: if not uri.port: - connection = httplib.HTTPConnection(uri.host) + connection = http.client.HTTPConnection(uri.host) else: - connection = httplib.HTTPConnection(uri.host, int(uri.port)) + connection = http.client.HTTPConnection(uri.host, int(uri.port)) return connection def _http_request(self, method, uri, headers=None, body_parts=None): @@ -458,7 +458,7 @@ which can be converted to strings using str. Each of these will be sent in order as the body of the HTTP request. """ - if isinstance(uri, (str, unicode)): + if isinstance(uri, str): uri = Uri.parse_uri(uri) connection = self._get_connection(uri, headers=headers) @@ -488,12 +488,12 @@ pass # Send the HTTP headers. - for header_name, value in headers.iteritems(): + for header_name, value in headers.items(): connection.putheader(header_name, value) connection.endheaders() # If there is data, send it in the request. - if body_parts and filter(lambda x: x != '', body_parts): + if body_parts and [x for x in body_parts if x != '']: for part in body_parts: _send_data_part(part, connection) @@ -502,7 +502,7 @@ def _send_data_part(data, connection): - if isinstance(data, (str, unicode)): + if isinstance(data, str): # I might want to just allow str, not unicode. connection.send(data) return @@ -570,9 +570,9 @@ sslobj = ssl.wrap_socket(p_sock, None, None) else: sock_ssl = socket.ssl(p_sock, None, Nonesock_) - sslobj = httplib.FakeSocket(p_sock, sock_ssl) + sslobj = http.client.FakeSocket(p_sock, sock_ssl) # Initalize httplib and replace with the proxy socket. - connection = httplib.HTTPConnection(proxy_uri.host) + connection = http.client.HTTPConnection(proxy_uri.host) connection.sock = sslobj return connection elif uri.scheme == 'http': @@ -581,7 +581,7 @@ proxy_uri.port = '80' if proxy_auth: headers['Proxy-Authorization'] = proxy_auth.strip() - return httplib.HTTPConnection(proxy_uri.host, int(proxy_uri.port)) + return http.client.HTTPConnection(proxy_uri.host, int(proxy_uri.port)) return None --- ./src/atom/http.py (original) +++ ./src/atom/http.py (refactored) @@ -37,7 +37,7 @@ import types import os -import httplib +import http.client import atom.url import atom.http_interface import socket @@ -103,7 +103,7 @@ # If the list of headers does not include a Content-Length, attempt to # calculate it based on the data object. if data and 'Content-Length' not in all_headers: - if isinstance(data, types.StringTypes): + if isinstance(data, (str,)): all_headers['Content-Length'] = str(len(data)) else: raise atom.http_interface.ContentLengthRequired('Unable to calculate ' @@ -123,7 +123,7 @@ return self.v2_http_client.request(http_request=http_request) if not isinstance(url, atom.url.Url): - if isinstance(url, types.StringTypes): + RefactoringTool: No changes to ./src/atom/data.py RefactoringTool: Refactored ./src/atom/core.py if isinstance(url, (str,)): url = atom.url.parse_url(url) else: raise atom.http_interface.UnparsableUrlObject('Unable to parse url ' @@ -175,19 +175,19 @@ def _prepare_connection(self, url, headers): if not isinstance(url, atom.url.Url): - if isinstance(url, types.StringTypes): + if isinstance(url, (str,)): url = atom.url.parse_url(url) else: raise atom.http_interface.UnparsableUrlObject('Unable to parse url ' 'parameter because it was not a string or atom.url.Url') if url.protocol == 'https': if not url.port: - return httplib.HTTPSConnection(url.host) - return httplib.HTTPSConnection(url.host, int(url.port)) + return http.client.HTTPSConnection(url.host) + return http.client.HTTPSConnection(url.host, int(url.port)) else: if not url.port: - return httplib.HTTPConnection(url.host) - return httplib.HTTPConnection(url.host, int(url.port)) + return http.client.HTTPConnection(url.host) + return http.client.HTTPConnection(url.host, int(url.port)) def _get_access_url(self, url): return url.to_string() @@ -259,10 +259,10 @@ sslobj = ssl.wrap_socket(p_sock, None, None) else: sock_ssl = socket.ssl(p_sock, None, None) - sslobj = httplib.FakeSocket(p_sock, sock_ssl) + sslobj = http.client.FakeSocket(p_sock, sock_ssl) # Initalize httplib and replace with the proxy socket. - connection = httplib.HTTPConnection(proxy_url.host) + connection = http.client.HTTPConnection(proxy_url.host) connection.sock = sslobj return connection else: @@ -275,7 +275,7 @@ if proxy_auth: headers['Proxy-Authorization'] = proxy_auth.strip() - return httplib.HTTPConnection(proxy_url.host, int(proxy_url.port)) + return http.client.HTTPConnection(proxy_url.host, int(proxy_url.port)) def _get_access_url(self, url): return url.to_string() @@ -343,7 +343,7 @@ def _send_data_part(data, connection): - if isinstance(data, types.StringTypes): + if isinstance(data, (str,)): connection.send(data) return # Check to see if data is a file-like object that has a read method. --- ./src/atom/core.py (original) +++ ./src/atom/core.py (refactored) @@ -93,7 +93,7 @@ if not pair[0].startswith('_') and pair[0] != 'text': member_type = pair[1] if (isinstance(member_type, tuple) or isinstance(member_type, list) - or isinstance(member_type, (str, unicode)) + or isinstance(member_type, str) or (inspect.isclass(member_type) and issubclass(member_type, XmlElement))): members.append(pair) @@ -173,7 +173,7 @@ attributes[target[version-1]] = member_name else: attributes[target[-1]] = member_name - elif isinstance(target, (str, unicode)): + elif isinstance(target, str): # This member points to an XML attribute. attributes[target] = member_name elif issubclass(target, XmlElement): @@ -207,7 +207,7 @@ matches = [] ignored1, elements, ignored2 = self.__class__._get_rules(version) if elements: - for qname, element_def in elements.iteritems(): + for qname, element_def in elements.items(): member = getattr(self, element_def[0]) if member: if _qname_matches(tag, namespace, qname): @@ -253,7 +253,7 @@ matches = [] ignored1, ignored2, attributes = self.__class__._get_rules(version) if attributes: - for qname, attribute_def in attributes.iteritems(): + for qname, attribute_def in attributes.items(): if isinstance(attribute_def, (list, tuple)): attribute_def = attribute_def[0] member = getattr(self, attribute_def) @@ -262,7 +262,7 @@ if member: if _qname_matches(tag, namespace, qname): matches.append(XmlAttribute(qname, member)) - for qname, value in self._otheRefactoringTool: Refactored ./src/atom/client.py RefactoringTool: No changes to ./src/atom/auth.py RefactoringTool: Refactored ./src/atom/__init__.py r_attributes.iteritems(): + for qname, value in self._other_attributes.items(): if _qname_matches(tag, namespace, qname): matches.append(XmlAttribute(qname, value)) return matches @@ -288,7 +288,7 @@ else: self._other_elements.append(_xml_element_from_tree(element, XmlElement, version)) - for attrib, value in tree.attrib.iteritems(): + for attrib, value in tree.attrib.items(): if attributes and attrib in attributes: setattr(self, attributes[attrib], value) else: @@ -318,7 +318,7 @@ encoding = encoding or STRING_ENCODING # Add the expected elements and attributes to the tree. if elements: - for tag, element_def in elements.iteritems(): + for tag, element_def in elements.items(): member = getattr(self, element_def[0]) # If this is a repeating element and there are members in the list. if member and element_def[2]: @@ -327,21 +327,21 @@ elif member: member._become_child(tree, version) if attributes: - for attribute_tag, member_name in attributes.iteritems(): + for attribute_tag, member_name in attributes.items(): value = getattr(self, member_name) if value: tree.attrib[attribute_tag] = value # Add the unexpected (other) elements and attributes to the tree. for element in self._other_elements: element._become_child(tree, version) - for key, value in self._other_attributes.iteritems(): + for key, value in self._other_attributes.items(): # I'm not sure if unicode can be used in the attribute name, so for now # we assume the encoding is correct for the attribute name. - if not isinstance(value, unicode): + if not isinstance(value, str): value = value.decode(encoding) tree.attrib[key] = value if self.text: - if isinstance(self.text, unicode): + if isinstance(self.text, str): tree.text = self.text else: tree.text = self.text.decode(encoding) @@ -512,7 +512,7 @@ """ if target_class is None: target_class = XmlElement - if isinstance(xml_string, unicode): + if isinstance(xml_string, str): if encoding is None: xml_string = xml_string.encode(STRING_ENCODING) else: --- ./src/atom/client.py (original) +++ ./src/atom/client.py (refactored) @@ -85,15 +85,15 @@ # Modify the request based on the AtomPubClient settings and parameters # passed in to the request. http_request = self.modify_request(http_request) - if isinstance(uri, (str, unicode)): + if isinstance(uri, str): uri = atom.http_core.Uri.parse_uri(uri) if uri is not None: uri.modify_request(http_request) - if isinstance(method, (str, unicode)): + if isinstance(method, str): http_request.method = method # Any unrecognized arguments are assumed to be capable of modifying the # HTTP request. - for name, value in kwargs.iteritems(): + for name, value in kwargs.items(): if value is not None: if hasattr(value, 'modify_request'): value.modify_request(http_request) @@ -218,7 +218,7 @@ An atom.http_core.HttpRequest() with the added custom headers. """ - for name, value in self.headers.iteritems(): + for name, value in self.headers.items(): if value is not None: http_request.headers[name] = value return http_request --- ./src/atom/__init__.py (original) +++ ./src/atom/__init__.py (refactored) @@ -93,7 +93,7 @@ # Preserve the original name to avoid masking all decorated functions as # 'deprecated_function' try: - optional_warn_function.func_name = f.func_name + optional_warn_function.__name__ = f.__name__ except TypeError: pass # In Python2.3 we can't set the func_name return optional_warn_function @@ -121,7 +121,7 @@ match those of the target class. """ encoding = string_encoding or XML_STRING_ENCODING - if encoding and isinstance(xml_string, unicode): + if encoding and isinstance(xml_string, str): xml_string = xml_string.encode(encoding) tree = ElementTree.fromstring(xml_string) return _CreateClassFromElementTree(target_class, tree) @@ -183,11 +183,11 @@ # Fill in the instance members from the contents of the XML tree. for child in tree: self._ConvertElementTreeToMember(child) - for attribute, value in tree.attrib.iteritems(): + for attribute, value in tree.attrib.items(): self._ConvertElementAttributeToMember(attribute, value) # Encode the text string according to the desired encoding type. (UTF-8) if tree.text: - if MEMBER_STRING_ENCODING is unicode: + if MEMBER_STRING_ENCODING is str: self.text = tree.text else: self.text = tree.text.encode(MEMBER_STRING_ENCODING) @@ -199,7 +199,7 @@ def _ConvertElementAttributeToMember(self, attribute, value): # Encode the attribute value's string with the desired type Default UTF-8 if value: - if MEMBER_STRING_ENCODING is unicode: + if MEMBER_STRING_ENCODING is str: self.extension_attributes[attribute] = value else: self.extension_attributes[attribute] = value.encode( @@ -209,15 +209,15 @@ def _AddMembersToElementTree(self, tree): for child in self.extension_elements: child._BecomeChildElement(tree) - for attribute, value in self.extension_attributes.iteritems(): + for attribute, value in self.extension_attributes.items(): if value: - if isinstance(value, unicode) or MEMBER_STRING_ENCODING is unicode: + if isinstance(value, str) or MEMBER_STRING_ENCODING is str: tree.attrib[attribute] = value else: # Decode the value from the desired encoding (default UTF-8). tree.attrib[attribute] = value.decode(MEMBER_STRING_ENCODING) if self.text: - if isinstance(self.text, unicode) or MEMBER_STRING_ENCODING is unicode: + if isinstance(self.text, str) or MEMBER_STRING_ENCODING is str: tree.text = self.text else: tree.text = self.text.decode(MEMBER_STRING_ENCODING) @@ -278,7 +278,7 @@ def _ConvertElementTreeToMember(self, child_tree): # Find the element's tag in this class's list of child members - if self.__class__._children.has_key(child_tree.tag): + if child_tree.tag in self.__class__._children: member_name = self.__class__._children[child_tree.tag][0] member_class = self.__class__._children[child_tree.tag][1] # If the class member is supposed to contain a list, make sure the @@ -297,13 +297,13 @@ def _ConvertElementAttributeToMember(self, attribute, value): # Find the attribute in this class's list of attributes. - if self.__class__._attributes.has_key(attribute): + if attribute in self.__class__._attributes: # Find the member of this class which corresponds to the XML attribute # (lookup in current_class._attributes) and set this member to the # desired value (using self.__dict__). if value: # Encode the string to capture non-ascii characters (default UTF-8) - if MEMBER_STRING_ENCODING is unicode: + if MEMBER_STRING_ENCODING is str: setattr(self, self.__class__._attributes[attribute], value) else: setattr(self, self.__class__._attributes[attribute], @@ -318,7 +318,7 @@ # This uses the class's _children dictionary to find the members which # should become XML child nodes. member_node_names = [values[0] for tag, values in - self.__class__._children.iteritems()] + self.__class__._children.items()] for member_name in member_node_names: member = getattr(self, member_name) if member is None: @@ -329,10 +329,10 @@ else: member._BecomeChildElement(tree) # Convert the members of this class which are XML attributes. - for xml_attribute, member_name in self.__class__._attributes.iteritems(): + for xml_attributRefactoringTool: No changes to ./setup.py RefactoringTool: Refactored ./samples/webmastertools/SitesFeedSummary.py RefactoringTool: Refactored ./samples/webmastertools/SitemapsFeedSummary.py e, member_name in self.__class__._attributes.items(): member = getattr(self, member_name) if member is not None: - if isinstance(member, unicode) or MEMBER_STRING_ENCODING is unicode: + if isinstance(member, str) or MEMBER_STRING_ENCODING is str: tree.attrib[xml_attribute] = member else: tree.attrib[xml_attribute] = member.decode(MEMBER_STRING_ENCODING) @@ -1374,7 +1374,7 @@ else: element_tree.tag = self.tag - for key, value in self.attributes.iteritems(): + for key, value in self.attributes.items(): element_tree.attrib[key] = value for child in self.children: @@ -1451,7 +1451,7 @@ namespace = None tag = element_tag extension = ExtensionElement(namespace=namespace, tag=tag) - for key, value in element_tree.attrib.iteritems(): + for key, value in element_tree.attrib.items(): extension.attributes[key] = value for child in element_tree: extension.children.append(_ExtensionElementFromElementTree(child)) @@ -1475,7 +1475,7 @@ # Preserve the original name to avoid masking all decorated functions as # 'deprecated_function' try: - deprecated_function.func_name = f.func_name + deprecated_function.__name__ = f.__name__ except TypeError: # Setting the func_name is not allowed in Python2.3. pass --- ./samples/webmastertools/SitesFeedSummary.py (original) +++ ./samples/webmastertools/SitesFeedSummary.py (refactored) @@ -28,26 +28,26 @@ username = '' password = '' -username = raw_input('Please enter your username: ') +username = input('Please enter your username: ') password = getpass.getpass() client = gdata.webmastertools.service.GWebmasterToolsService( email=username, password=password, source='PythonWebmasterToolsSample-1') -print 'Logging in' +print('Logging in') client.ProgrammaticLogin() -print 'Retrieving Sites feed' +print('Retrieving Sites feed') feed = client.GetSitesFeed() # Format the feed -print -print 'You have %d site(s), last updated at %s' % ( - len(feed.entry), feed.updated.text) -print -print "%-25s %25s %25s" % ('Site', 'Last Updated', 'Last Crawled') -print '='*80 +print() +print('You have %d site(s), last updated at %s' % ( + len(feed.entry), feed.updated.text)) +print() +print("%-25s %25s %25s" % ('Site', 'Last Updated', 'Last Crawled')) +print('='*80) def safeElementText(element): @@ -58,13 +58,13 @@ # Format each site for entry in feed.entry: - print "%-25s %25s %25s" % ( + print("%-25s %25s %25s" % ( entry.title.text.replace('http://', '')[:25], entry.updated.text[:25], - safeElementText(entry.crawled)[:25]) - print " Preferred: %-23s Indexed: %5s GeoLoc: %10s" % ( + safeElementText(entry.crawled)[:25])) + print(" Preferred: %-23s Indexed: %5s GeoLoc: %10s" % ( safeElementText(entry.preferred_domain)[:30], entry.indexed.text[:5], - safeElementText(entry.geolocation)[:10]) - print " Crawl rate: %-10s Verified: %5s" % ( - safeElementText(entry.crawl_rate)[:10], entry.verified.text[:5]) + safeElementText(entry.geolocation)[:10])) + print(" Crawl rate: %-10s Verified: %5s" % ( + safeElementText(entry.crawl_rate)[:10], entry.verified.text[:5])) -print +print() --- ./samples/webmastertools/SitemapsFeedSummary.py (original) +++ ./samples/webmastertools/SitemapsFeedSummary.py (refactored) @@ -29,26 +29,26 @@ password = '' site_uri = '' -username = raw_input('Please enter your username: ') +username = input('Please enter your username: ') password = getpass.getpass() -site_uri = raw_input('Please enter your site url: ') +site_uri = input('Please enter your site url: ') client = gdata.webmastertools.service.GWebmasterToolsService( email=username, password=password, source='PythonWebmasterToolsSample-1') -print 'Logging in' +print('Logging in') client.ProgrammaticLogin() -print 'Retrieving Sitemaps feed' +print('Retrieving Sitemaps feed') feed = client.GetSitemapsFeed(site_uri) # Format the feed -RefactoringTool: Refactored ./samples/webmastertools/AddDeleteExampleDotCom.py print -print 'You have %d sitemap(s), last updated at %s' % ( - len(feed.entry), feed.updated.text) -print -print '='*80 +print() +print('You have %d sitemap(s), last updated at %s' % ( + len(feed.entry), feed.updated.text)) +print() +print('='*80) def safeElementText(element): @@ -59,10 +59,10 @@ # Format each site for entry in feed.entry: - print entry.title.text.replace('http://', '')[:80] - print " Last Updated : %29s Status: %10s" % ( - entry.updated.text[:29], entry.sitemap_status.text[:10]) - print " Last Downloaded: %29s URL Count: %10s" % ( + print(entry.title.text.replace('http://', '')[:80]) + print(" Last Updated : %29s Status: %10s" % ( + entry.updated.text[:29], entry.sitemap_status.text[:10])) + print(" Last Downloaded: %29s URL Count: %10s" % ( safeElementText(entry.sitemap_last_downloaded)[:29], - safeElementText(entry.sitemap_url_count)[:10]) -print + safeElementText(entry.sitemap_url_count)[:10])) +print() --- ./samples/webmastertools/AddDeleteExampleDotCom.py (original) +++ ./samples/webmastertools/AddDeleteExampleDotCom.py (refactored) @@ -15,7 +15,7 @@ # limitations under the License. -import urllib +import urllib.request, urllib.parse, urllib.error import gdata.webmastertools.service import gdata.service @@ -30,7 +30,7 @@ username = '' password = '' -username = raw_input('Please enter your username: ') +username = input('Please enter your username: ') password = getpass.getpass() client = gdata.webmastertools.service.GWebmasterToolsService( @@ -47,24 +47,24 @@ return '' -print 'Logging in' +print('Logging in') client.ProgrammaticLogin() -print -print 'Adding site: %s' % EXAMPLE_SITE +print() +print('Adding site: %s' % EXAMPLE_SITE) entry = client.AddSite(EXAMPLE_SITE) -print -print "%-25s %25s %25s" % ('Site', 'Last Updated', 'Last Crawled') -print '='*80 -print "%-25s %25s %25s" % ( +print() +print("%-25s %25s %25s" % ('Site', 'Last Updated', 'Last Crawled')) +print('='*80) +print("%-25s %25s %25s" % ( entry.title.text.replace('http://', '')[:25], entry.updated.text[:25], - safeElementText(entry.crawled)[:25]) -print " Preferred: %-23s Indexed: %5s GeoLoc: %10s" % ( + safeElementText(entry.crawled)[:25])) +print(" Preferred: %-23s Indexed: %5s GeoLoc: %10s" % ( safeElementText(entry.preferred_domain)[:30], entry.indexed.text[:5], - safeElementText(entry.geolocation)[:10]) -print " Crawl rate: %-10s Verified: %5s" % ( - safeElementText(entry.crawl_rate)[:10], entry.verified.text[:5]) + safeElementText(entry.geolocation)[:10])) +print(" Crawl rate: %-10s Verified: %5s" % ( + safeElementText(entry.crawl_rate)[:10], entry.verified.text[:5])) # Verifying a site. This sample won't do this since we don't own example.com #client.VerifySite(EXAMPLE_SITE, 'htmlpage') @@ -75,16 +75,16 @@ #client.UpdatePreferredDomain(EXAMPLE_SITE, 'preferwww') #client.UpdateEnhancedImageSearch(EXAMPLE_SITE, 'true') -print -print 'Adding sitemap: %s' % EXAMPLE_SITEMAP +print() +print('Adding sitemap: %s' % EXAMPLE_SITEMAP) entry = client.AddSitemap(EXAMPLE_SITE, EXAMPLE_SITEMAP) -print entry.title.text.replace('http://', '')[:80] -print " Last Updated : %29s Status: %10s" % ( - entry.updated.text[:29], entry.sitemap_status.text[:10]) -print " Last Downloaded: %29s URL Count: %10s" % ( +print(entry.title.text.replace('http://', '')[:80]) +print(" Last Updated : %29s Status: %10s" % ( + entry.updated.text[:29], entry.sitemap_status.text[:10])) +print(" Last Downloaded: %29s URL Count: %10s" % ( safeElementText(entry.sitemap_last_downloaded)[:29], - safeElementText(entry.sitemap_url_count)[:10]) + safeElementText(entry.sitemap_url_count)[:10])) # Add a mobile sitemap #entry = client.AddMobileSitemap(EXAMPLE_SITE, 'http://.../sitemap-mobile-example.xml', 'XHTML') @@ -93,11 +93,11 @@ # See also http://google.com/support/webmasters/bin/answer.py?answer=42738 #entryRefactoringTool: Refactored ./samples/spreadsheets/spreadsheetExample.py = client.AddNewsSitemap(EXAMPLE_SITE, 'http://.../sitemap-news-example.xml', 'Label') -print -print 'Deleting sitemap: %s' % EXAMPLE_SITEMAP +print() +print('Deleting sitemap: %s' % EXAMPLE_SITEMAP) client.DeleteSitemap(EXAMPLE_SITE, EXAMPLE_SITEMAP) -print -print 'Deleting site: %s' % EXAMPLE_SITE +print() +print('Deleting site: %s' % EXAMPLE_SITE) client.DeleteSite(EXAMPLE_SITE) -print +print() --- ./samples/spreadsheets/spreadsheetExample.py (original) +++ ./samples/spreadsheets/spreadsheetExample.py (refactored) @@ -48,7 +48,7 @@ # Get the list of spreadsheets feed = self.gd_client.GetSpreadsheetsFeed() self._PrintFeed(feed) - input = raw_input('\nSelection: ') + input = input('\nSelection: ') id_parts = feed.entry[string.atoi(input)].id.text.split('/') self.curr_key = id_parts[len(id_parts) - 1] @@ -56,7 +56,7 @@ # Get the list of worksheets feed = self.gd_client.GetWorksheetsFeed(self.curr_key) self._PrintFeed(feed) - input = raw_input('\nSelection: ') + input = input('\nSelection: ') id_parts = feed.entry[string.atoi(input)].id.text.split('/') self.curr_wksht_id = id_parts[len(id_parts) - 1] @@ -64,7 +64,7 @@ print ('dump\n' 'update {row} {col} {input_value}\n' '\n') - input = raw_input('Command: ') + input = input('Command: ') command = input.split(' ', 1) if command[0] == 'dump': self._CellsGetAction() @@ -84,7 +84,7 @@ 'delete {row_index}\n' 'Note: No uppercase letters in column names!\n' '\n') - input = raw_input('Command: ') + input = input('Command: ') command = input.split(' ' , 1) if command[0] == 'dump': self._ListGetAction() @@ -107,7 +107,7 @@ entry = self.gd_client.UpdateCell(row=row, col=col, inputValue=inputValue, key=self.curr_key, wksht_id=self.curr_wksht_id) if isinstance(entry, gdata.spreadsheet.SpreadsheetsCell): - print 'Updated!' + print('Updated!') def _ListGetAction(self): # Get the list feed @@ -118,7 +118,7 @@ entry = self.gd_client.InsertRow(self._StringToDictionary(row_data), self.curr_key, self.curr_wksht_id) if isinstance(entry, gdata.spreadsheet.SpreadsheetsList): - print 'Inserted!' + print('Inserted!') def _ListUpdateAction(self, index, row_data): self.list_feed = self.gd_client.GetListFeed(self.curr_key, self.curr_wksht_id) @@ -126,12 +126,12 @@ self.list_feed.entry[string.atoi(index)], self._StringToDictionary(row_data)) if isinstance(entry, gdata.spreadsheet.SpreadsheetsList): - print 'Updated!' + print('Updated!') def _ListDeleteAction(self, index): self.list_feed = self.gd_client.GetListFeed(self.curr_key, self.curr_wksht_id) self.gd_client.DeleteRow(self.list_feed.entry[string.atoi(index)]) - print 'Deleted!' + print('Deleted!') def _StringToDictionary(self, row_data): dict = {} @@ -143,25 +143,25 @@ def _PrintFeed(self, feed): for i, entry in enumerate(feed.entry): if isinstance(feed, gdata.spreadsheet.SpreadsheetsCellsFeed): - print '%s %s\n' % (entry.title.text, entry.content.text) + print('%s %s\n' % (entry.title.text, entry.content.text)) elif isinstance(feed, gdata.spreadsheet.SpreadsheetsListFeed): - print '%s %s %s' % (i, entry.title.text, entry.content.text) + print('%s %s %s' % (i, entry.title.text, entry.content.text)) # Print this row's value for each column (the custom dictionary is # built using the gsx: elements in the entry.) - print 'Contents:' + print('Contents:') for key in entry.custom: - print ' %s: %s' % (key, entry.custom[key].text) - print '\n', + print(' %s: %s' % (key, entry.custom[key].text)) + print('\n', end=' ') else: - print '%s %s\n' % (i, entry.title.text) + print('%s %s\n' % (i, entry.title.text)) def _InvalidCommandError(self, input):RefactoringTool: Refactored ./samples/sites/sites_example.py - print 'Invalid input: %s\n' % (input) + print('Invalid input: %s\n' % (input)) def Run(self): self._PromptForSpreadsheet() self._PromptForWorksheet() - input = raw_input('cells or list? ') + input = input('cells or list? ') if input == 'cells': while True: self._PromptForCellsAction() @@ -174,8 +174,8 @@ # parse command line options try: opts, args = getopt.getopt(sys.argv[1:], "", ["user=", "pw="]) - except getopt.error, msg: - print 'python spreadsheetExample.py --user [username] --pw [password] ' + except getopt.error as msg: + print('python spreadsheetExample.py --user [username] --pw [password] ') sys.exit(2) user = '' @@ -189,7 +189,7 @@ pw = a if user == '' or pw == '': - print 'python spreadsheetExample.py --user [username] --pw [password] ' + print('python spreadsheetExample.py --user [username] --pw [password] ') sys.exit(2) sample = SimpleCRUD(user, pw) --- ./samples/sites/sites_example.py (original) +++ ./samples/sites/sites_example.py (refactored) @@ -73,17 +73,17 @@ def PrintMainMenu(self): """Displays a menu of options for the user to choose from.""" - print '\nSites API Sample' - print '================================' - print '\n'.join(MAIN_MENU) - print '================================\n' + print('\nSites API Sample') + print('================================') + print('\n'.join(MAIN_MENU)) + print('================================\n') def PrintSettingsMenu(self): """Displays a menu of settings for the user change.""" - print '\nSites API Sample > Settings' - print '================================' - print '\n'.join(SETTINGS_MENU) - print '================================\n' + print('\nSites API Sample > Settings') + print('================================') + print('\n'.join(SETTINGS_MENU)) + print('================================\n') def GetMenuChoice(self, menu): """Retrieves the menu selection from the user. @@ -96,7 +96,7 @@ """ max_choice = len(menu) while True: - user_input = raw_input(': ') + user_input = input(': ') try: num = int(user_input) @@ -109,57 +109,57 @@ def PromptSiteName(self): site_name = '' while not site_name: - site_name = raw_input('site name: ') + site_name = input('site name: ') if not site_name: - print 'Please enter the name of your Google Site.' + print('Please enter the name of your Google Site.') return site_name def PromptDomain(self): - return raw_input(('If your Site is hosted on a Google Apps domain, ' + return input(('If your Site is hosted on a Google Apps domain, ' 'enter it (e.g. example.com): ')) or 'site' def GetChoiceSelection(self, feed, message): for i, entry in enumerate(feed.entry): - print '%d.) %s' % (i + 1, entry.title.text) + print('%d.) %s' % (i + 1, entry.title.text)) choice = 0 while not choice or not 0 <= choice <= len(feed.entry): - choice = int(raw_input(message)) - print + choice = int(input(message)) + print() return choice def PrintEntry(self, entry): - print '%s [%s]' % (entry.title.text, entry.Kind()) + print('%s [%s]' % (entry.title.text, entry.Kind())) if entry.page_name: - print ' page name:\t%s' % entry.page_name.text + print(' page name:\t%s' % entry.page_name.text) if entry.content: - print ' content\t%s...' % str(entry.content.html)[0:100] + print(' content\t%s...' % str(entry.content.html)[0:100]) def PrintListItem(self, entry): - print '%s [%s]' % (entry.title.text, entry.Kind()) + print('%s [%s]' % (entry.title.text, entry.Kind())) for col in entry.field: - print ' %s %s\t%s' % (col.index, col.name, col.text) + print(' %s %s\t%s' % (col.index, col.name, col.text)) def PrintListPage(self, entry): - print '%s [%s]' % (entry.title.text, entry.Kind()) + print('%s [%s]' % (entry.title.text, entry.Kind())) for col in entry.data.column: - print ' %s %s' % (col.index, col.name) + print(' %s %s' % (col.index, col.name)) def PrintFileCabinetPage(self, entry): - print '%s [%s]' % (entry.title.text, entry.Kind()) - print ' page name:\t%s' % entry.page_name.text - print ' content\t%s...' % str(entry.content.html)[0:100] + print('%s [%s]' % (entry.title.text, entry.Kind())) + print(' page name:\t%s' % entry.page_name.text) + print(' content\t%s...' % str(entry.content.html)[0:100]) def PrintAttachment(self, entry): - print '%s [%s]' % (entry.title.text, entry.Kind()) + print('%s [%s]' % (entry.title.text, entry.Kind())) if entry.summary is not None: - print ' description:\t%s' % entry.summary.text - print ' content\t%s, %s' % (entry.content.type, entry.content.src) + print(' description:\t%s' % entry.summary.text) + print(' content\t%s, %s' % (entry.content.type, entry.content.src)) def PrintWebAttachment(self, entry): - print '%s [%s]' % (entry.title.text, entry.Kind()) + print('%s [%s]' % (entry.title.text, entry.Kind())) if entry.summary.text is not None: - print ' description:\t%s' % entry.summary.text - print ' content src\t%s' % entry.content.src + print(' description:\t%s' % entry.summary.text) + print(' content src\t%s' % entry.content.src) def Run(self): """Executes the demo application.""" @@ -170,7 +170,7 @@ choice = self.GetMenuChoice(MAIN_MENU) if choice == 1: - kind_choice = raw_input('What kind (all|%s)?: ' % '|'.join( + kind_choice = input('What kind (all|%s)?: ' % '|'.join( gdata.sites.data.SUPPORT_KINDS)) if kind_choice in gdata.sites.data.SUPPORT_KINDS: uri = '%s?kind=%s' % (self.client.make_content_feed_uri(), @@ -179,7 +179,7 @@ else: feed = self.client.GetContentFeed() - print "\nFetching content feed of '%s'...\n" % self.client.site + print("\nFetching content feed of '%s'...\n" % self.client.site) for entry in feed.entry: kind = entry.Kind() @@ -197,36 +197,36 @@ else: self.PrintEntry(entry) - print ' revision:\t%s' % entry.revision.text - print ' updated:\t%s' % entry.updated.text + print(' revision:\t%s' % entry.revision.text) + print(' updated:\t%s' % entry.updated.text) parent_link = entry.FindParentLink() if parent_link: - print ' parent link:\t%s' % parent_link + print(' parent link:\t%s' % parent_link) if entry.GetAlternateLink(): - print ' view in Sites:\t%s' % entry.GetAlternateLink().href + print(' view in Sites:\t%s' % entry.GetAlternateLink().href) if entry.feed_link: - print ' feed of items:\t%s' % entry.feed_link.href + print(' feed of items:\t%s' % entry.feed_link.href) if entry.IsDeleted(): - print ' deleted:\t%s' % entry.IsDeleted() + print(' deleted:\t%s' % entry.IsDeleted()) if entry.in_reply_to: - print ' in reply to:\t%s' % entry.in_reply_to.href - - print + print(' in reply to:\t%s' % entry.in_reply_to.href) + + print() elif choice == 2: - print "\nFetching activity feed of '%s'..." % self.client.site + print("\nFetching activity feed of '%s'..." % self.client.site) feed = self.client.GetActivityFeed() for entry in feed.entry: - print ' %s [%s on %s]' % (entry.title.text, entry.Kind(), - entry.updated.text) + print(' %s [%s on %s]' % (entry.title.text, entry.Kind(), + entry.updated.text)) elif choice == 3: - print "\nFetching content feed of '%s'...\n" % self.client.site + print("\nFetching content feed of '%s'...\n" % self.client.site) feed = self.client.GetContentFeed() try: @@ -240,14 +240,14 @@ feed = self.client.GetRevisionFeed( feed.entry[selection - 1].GetNodeId()) for entry in feed.entry: - print entry.title.text - print ' new version on:\t%s' % entry.updated.text - print ' view changes:\t%s' % entry.GetAlternateLink().href - print ' current version:\t%s...' % str(entry.content.html)[0:100] - print + print(entry.title.text) + print(' new version on:\t%s' % entry.updated.text) + print(' view changes:\t%s' % entry.GetAlternateLink().href) + print(' current version:\t%s...' % str(entry.content.html)[0:100]) + print() elif choice == 4: - print "\nFetching content feed of '%s'...\n" % self.client.site + print("\nFetching content feed of '%s'...\n" % self.client.site) feed = self.client.GetContentFeed() try: @@ -256,7 +256,7 @@ except ValueError: selection = None - page_title = raw_input('Enter a page title: ') + page_title = input('Enter a page title: ') parent = None if selection is not None: @@ -266,10 +266,10 @@ 'webpage', page_title, 'Your html content', parent=parent) if new_entry.GetAlternateLink(): - print 'Created. View it at: %s' % new_entry.GetAlternateLink().href + print('Created. View it at: %s' % new_entry.GetAlternateLink().href) elif choice == 5: - print "\nFetching filecabinets on '%s'...\n" % self.client.site + print("\nFetching filecabinets on '%s'...\n" % self.client.site) uri = '%s?kind=%s' % (self.client.make_content_feed_uri(), 'filecabinet') @@ -278,10 +278,10 @@ selection = self.GetChoiceSelection( feed, 'Select a filecabinet to create the web attachment on: ') - url = raw_input('Enter the URL of the attachment: ') - content_type = raw_input("Enter the attachment's mime type: ") - title = raw_input('Enter a title for the web attachment: ') - description = raw_input('Enter a description: ') + url = input('Enter the URL of the attachment: ') + content_type = input("Enter the attachment's mime type: ") + title = input('Enter a title for the web attachment: ') + description = input('Enter a description: ') parent_entry = None if selection is not None: @@ -289,10 +289,10 @@ self.client.CreateWebAttachment(url, content_type, title, parent_entry, description=description) - print 'Created!' + print('Created!') elif choice == 6: - print "\nFetching filecainets on '%s'...\n" % self.client.site + print("\nFetching filecainets on '%s'...\n" % self.client.site) uri = '%s?kind=%s' % (self.client.make_content_feed_uri(), 'filecabinet') @@ -301,14 +301,14 @@ selection = self.GetChoiceSelection( feed, 'Select a filecabinet to upload to: ') - filepath = raw_input('Enter a filename: ') - page_title = raw_input('Enter a title for the file: ') - description = raw_input('Enter a description: ') + filepath = input('Enter a filename: ') + page_title = input('Enter a title for the file: ') + description = input('Enter a description: ') filename = os.path.basename(filepath) file_ex = filename[filename.rfind('.'):] if not file_ex in mimetypes.types_map: - content_type = raw_input( + content_type = input( 'Unrecognized file extension. Please enter the mime type: ') else: content_type = mimetypes.types_map[file_ex] @@ -320,10 +320,10 @@ new_entry = self.client.UploadAttachment( filepath, entry, content_type=content_type, title=page_title, description=description) - print 'Uploaded. View it at: %s' % new_entry.GetAlternateLink().href + print('Uploaded. View it at: %s' % new_entry.GetAlternateLink().href) elif choice == 7: - print "\nFetching all attachments on '%s'...\n" % self.client.site + print("\nFetching all attachments on '%s'...\n" % self.client.site) uri = '%s?kind=%s' % (self.client.make_content_feed_uri(), 'attachment') @@ -332,17 +332,17 @@ selection = self.GetChoiceSelection( feed, 'Select an attachment to download: ') - filepath = raw_input('Save as: ') + filepath = input('Save as: ') entry = None if selection is not None: entry = feed.entry[selection - 1] self.client.DownloadAttachment(entry, filepath) - print 'Downloaded.' + print('Downloaded.') elif choice == 8: - print "\nFetching content feed of '%s'...\n" % self.client.site + print("\nFetching content feed of '%s'...\n" % self.client.site) feed = self.client.GetContentFeed() selection = self.GetChoiceSelection(feed, 'Select a page to delete: ') @@ -352,38 +352,38 @@ entry = feed.entry[selection - 1] self.client.Delete(entry) - print 'Removed!' + print('Removed!') elif choice == 9: - print ('\nFetching your list of sites for domain: %s...\n' - % self.client.domain) + print(('\nFetching your list of sites for domain: %s...\n' + % self.client.domain)) feed = self.client.GetSiteFeed() for entry in feed.entry: - print entry.title.text - print ' site name: ' + entry.site_name.text + print(entry.title.text) + print(' site name: ' + entry.site_name.text) if entry.summary.text: - print ' summary: ' + entry.summary.text + print(' summary: ' + entry.summary.text) if entry.FindSourceLink(): - print ' copied from site: ' + entry.FindSourceLink() - print ' acl feed: %s\n' % entry.FindAclLink() + print(' copied from site: ' + entry.FindSourceLink()) + print(' acl feed: %s\n' % entry.FindAclLink()) elif choice == 10: - title = raw_input('Enter a title: ') - summary = raw_input('Enter a description: ') - theme = raw_input('Theme name (ex. "default"): ') + title = input('Enter a title: ') + summary = input('Enter a description: ') + theme = input('Theme name (ex. "default"): ') new_entry = self.client.CreateSite( title, description=summary, theme=theme) - print 'Site created! View it at: ' + new_entry.GetAlternateLink().href + print('Site created! View it at: ' + new_entry.GetAlternateLink().href) elif choice == 11: - print "\nFetching acl permissions of '%s'...\n" % self.client.site + print("\nFetching acl permissions of '%s'...\n" % self.client.site) feed = self.client.GetAclFeed() for entry in feed.entry: - print '%s (%s) - %s' % (entry.scope.value, entry.scope.type, - entry.role.value) + print('%s (%s) - %s' % (entry.scope.value, entry.scope.type, + entry.role.value)) elif choice == 12: self.PrintSettingsMenu() @@ -395,11 +395,11 @@ self.client.domain = self.PromptDomain() elif choice == 13: - print 'Later!\n' + print('Later!\n') return - except gdata.client.RequestError, error: - print error + except gdata.client.RequestError as error: + print(error) except KeyboardInterrupt: return @@ -407,15 +407,15RefactoringTool: Refactored ./samples/oauth/oauth_on_appengine/main_rsa.py RefactoringTool: Refactored ./samples/oauth/oauth_on_appengine/main_hmac.py RefactoringTool: Refactored ./samples/oauth/oauth_on_appengine/appengine_utilities/sessions.py @@ def main(): """The main function runs the SitesExample application.""" - print 'NOTE: Please run these tests only with a test account.\n' + print('NOTE: Please run these tests only with a test account.\n') try: opts, args = getopt.getopt(sys.argv[1:], '', ['site=', 'domain=', 'debug']) - except getopt.error, msg: - print """python sites_sample.py --site [sitename] + except getopt.error as msg: + print("""python sites_sample.py --site [sitename] --domain [domain or "site"] - --debug [prints debug info if set]""" + --debug [prints debug info if set]""") sys.exit(2) site = None --- ./samples/oauth/oauth_on_appengine/main_rsa.py (original) +++ ./samples/oauth/oauth_on_appengine/main_rsa.py (refactored) @@ -171,7 +171,7 @@ 'lastViewed': last_viewed }) self.response.out.write(simplejson.dumps(json)) - except gdata.service.RequestError, error: + except gdata.service.RequestError as error: OAuthDance.post(self) class RevokeToken(webapp.RequestHandler): --- ./samples/oauth/oauth_on_appengine/main_hmac.py (original) +++ ./samples/oauth/oauth_on_appengine/main_hmac.py (refactored) @@ -173,7 +173,7 @@ 'lastViewed': last_viewed }) self.response.out.write(simplejson.dumps(json)) - except gdata.service.RequestError, error: + except gdata.service.RequestError as error: OAuthDance.post(self) class RevokeToken(webapp.RequestHandler): --- ./samples/oauth/oauth_on_appengine/appengine_utilities/sessions.py (original) +++ ./samples/oauth/oauth_on_appengine/appengine_utilities/sessions.py (refactored) @@ -32,7 +32,7 @@ import datetime import random import md5 -import Cookie +import http.cookies import pickle import __main__ from time import strftime @@ -45,7 +45,7 @@ #django simplejson import, used for flash from django.utils import simplejson -from rotmodel import ROTModel +from .rotmodel import ROTModel # settings, if you have these set elsewhere, such as your django settings file, # you'll need to adjust the values to pull from there. @@ -302,11 +302,11 @@ # datestore write trumps cookie. If there is a cookie value # with this keyname, delete it so we don't have conflicting # entries. - if session.cookie_vals.has_key(keyname): + if keyname in session.cookie_vals: del(session.cookie_vals[keyname]) session.output_cookie[session.cookie_name + '_data'] = \ simplejson.dumps(session.cookie_vals) - print session.output_cookie.output() + print(session.output_cookie.output()) sessdata = session._get(keyname=keyname) if sessdata is None: @@ -340,7 +340,7 @@ session.cache[keyname] = value session.output_cookie[session.cookie_name + '_data'] = \ simplejson.dumps(session.cookie_vals) - print session.output_cookie.output() + print(session.output_cookie.output()) class Session(object): """ @@ -421,8 +421,8 @@ # Check the cookie and, if necessary, create a new one. self.cache = {} string_cookie = os.environ.get('HTTP_COOKIE', '') - self.cookie = Cookie.SimpleCookie() - self.output_cookie = Cookie.SimpleCookie() + self.cookie = http.cookies.SimpleCookie() + self.output_cookie = http.cookies.SimpleCookie() self.cookie.load(string_cookie) try: self.cookie_vals = \ @@ -502,15 +502,15 @@ self.session.put() if self.set_cookie_expires: - if not self.output_cookie.has_key(cookie_name + '_data'): + if cookie_name + '_data' not in self.output_cookie: self.output_cookie[cookie_name + '_data'] = "" self.output_cookie[cookie_name + '_data']['expires'] = \ self.session_expire_time - prRefactoringTool: No changes to ./samples/oauth/oauth_on_appengine/appengine_utilities/rotmodel.py RefactoringTool: Refactored ./samples/oauth/oauth_on_appengine/appengine_utilities/paginator.py RefactoringTool: Refactored ./samples/oauth/oauth_on_appengine/appengine_utilities/flash.py int self.output_cookie.output() + print(self.output_cookie.output()) # fire up a Flash object if integration is enabled if self.integrate_flash: - import flash + from . import flash self.flash = flash.Flash(cookie=self.cookie) # randomly delete old stale sessions in the datastore (see @@ -588,7 +588,7 @@ elif keyname in ('sid', 'flash'): raise ValueError(keyname + ' is a reserved keyname.') - if type(keyname) != type([str, unicode]): + if type(keyname) != type([str, str]): return str(keyname) return keyname @@ -617,7 +617,7 @@ self.cache = {} self.output_cookie[self.cookie_name + '_data'] = \ simplejson.dumps(self.cookie_vals) - print self.output_cookie.output() + print(self.output_cookie.output()) """ OLD if hasattr(self, "session"): @@ -778,7 +778,7 @@ bad_key = False self.output_cookie[self.cookie_name + '_data'] = \ simplejson.dumps(self.cookie_vals) - print self.output_cookie.output() + print(self.output_cookie.output()) if bad_key: raise KeyError(str(keyname)) if keyname in self.cache: @@ -872,11 +872,11 @@ Adds headers, avoiding any page caching in the browser. Useful for highly dynamic sites. """ - print "Expires: Tue, 03 Jul 2001 06:00:00 GMT" - print strftime("Last-Modified: %a, %d %b %y %H:%M:%S %Z") - print "Cache-Control: no-store, no-cache, must-revalidate, max-age=0" - print "Cache-Control: post-check=0, pre-check=0" - print "Pragma: no-cache" + print("Expires: Tue, 03 Jul 2001 06:00:00 GMT") + print(strftime("Last-Modified: %a, %d %b %y %H:%M:%S %Z")) + print("Cache-Control: no-store, no-cache, must-revalidate, max-age=0") + print("Cache-Control: post-check=0, pre-check=0") + print("Pragma: no-cache") def clear(self): """ @@ -892,7 +892,7 @@ self.cookie_vals = {} self.output_cookie[self.cookie_name + '_data'] = \ simplejson.dumps(self.cookie_vals) - print self.output_cookie.output() + print(self.output_cookie.output()) def has_key(self, keyname): """ @@ -983,9 +983,9 @@ """ string_cookie = os.environ.get('HTTP_COOKIE', '') - cookie = Cookie.SimpleCookie() + cookie = http.cookies.SimpleCookie() cookie.load(string_cookie) - if cookie.has_key(cookie_name): + if cookie_name in cookie: query = _AppEngineUtilities_Session.all() query.filter('sid', cookie[cookie_name].value) results = query.fetch(1) @@ -993,8 +993,8 @@ return True else: if delete_invalid: - output_cookie = Cookie.SimpleCookie() + output_cookie = http.cookies.SimpleCookie() output_cookie[cookie_name] = cookie[cookie_name] output_cookie[cookie_name]['expires'] = 0 - print output_cookie.output() + print(output_cookie.output()) return False --- ./samples/oauth/oauth_on_appengine/appengine_utilities/paginator.py (original) +++ ./samples/oauth/oauth_on_appengine/appengine_utilities/paginator.py (refactored) @@ -26,7 +26,7 @@ """ from google.appengine.ext import db -from cache import Cache +from .cache import Cache class Paginator(object): """ @@ -75,7 +75,7 @@ cache_string = cache_string + q_filter + "_" + q_filters[q_filter] + "_" cache_string = cache_string + "index" c = Cache() - if c.has_key(cache_string): + if cache_string in c: return c[cache_string] # build query --- ./samples/oauth/oauth_on_appengine/appengine_utilities/flash.py (original) +++ ./samples/oauth/oauth_on_appengine/appengine_utilities/flash.py (refactored) @@ -27,7 +27RefactoringTool: No changes to ./samples/oauth/oauth_on_appengine/appengine_utilities/event.py RefactoringTool: Refactored ./samples/oauth/oauth_on_appengine/appengine_utilities/cron.py ,7 @@ import os import sys -import Cookie +import http.cookies import pickle from time import strftime @@ -68,7 +68,7 @@ # load cookie if cookie is None: browser_cookie = os.environ.get('HTTP_COOKIE', '') - self.cookie = Cookie.SimpleCookie() + self.cookie = http.cookies.SimpleCookie() self.cookie.load(browser_cookie) else: self.cookie = cookie @@ -88,7 +88,7 @@ self.cookie[COOKIE_NAME] = '' self.cookie[COOKIE_NAME]['path'] = '/' self.cookie[COOKIE_NAME]['expires'] = 0 - print self.cookie[COOKIE_NAME] + print(self.cookie[COOKIE_NAME]) else: # default 'msg' attribute to None self.__dict__['msg'] = None @@ -103,7 +103,7 @@ self.__dict__['msg'] = value self.__dict__['cookie'][COOKIE_NAME] = simplejson.dumps(value) self.__dict__['cookie'][COOKIE_NAME]['path'] = '/' - print self.cookie + print(self.cookie) else: raise ValueError('You can only set the "msg" attribute.') @@ -112,8 +112,8 @@ Adds headers, avoiding any page caching in the browser. Useful for highly dynamic sites. """ - print "Expires: Tue, 03 Jul 2001 06:00:00 GMT" - print strftime("Last-Modified: %a, %d %b %y %H:%M:%S %Z") - print "Cache-Control: no-store, no-cache, must-revalidate, max-age=0" - print "Cache-Control: post-check=0, pre-check=0" - print "Pragma: no-cache" + print("Expires: Tue, 03 Jul 2001 06:00:00 GMT") + print(strftime("Last-Modified: %a, %d %b %y %H:%M:%S %Z")) + print("Cache-Control: no-store, no-cache, must-revalidate, max-age=0") + print("Cache-Control: post-check=0, pre-check=0") + print("Pragma: no-cache") --- ./samples/oauth/oauth_on_appengine/appengine_utilities/cron.py (original) +++ ./samples/oauth/oauth_on_appengine/appengine_utilities/cron.py (refactored) @@ -92,7 +92,7 @@ def add_cron(self, cron_string): cron = cron_string.split(" ") if len(cron) is not 6: - raise ValueError, 'Invalid cron string. Format: * * * * * url' + raise ValueError('Invalid cron string. Format: * * * * * url') cron = { 'min': cron[0], 'hour': cron[1], @@ -149,35 +149,35 @@ elif v == "*": return "*" else: - raise ValueError, "Invalid day of week." + raise ValueError("Invalid day of week.") elif t == "mon": if v >= 1 and v <= 12: return [v] elif v == "*": - return range(1, 12) - else: - raise ValueError, "Invalid month." + return list(range(1, 12)) + else: + raise ValueError("Invalid month.") elif t == "day": if v >= 1 and v <= 31: return [v] elif v == "*": - return range(1, 31) - else: - raise ValueError, "Invalid day." + return list(range(1, 31)) + else: + raise ValueError("Invalid day.") elif t == "hour": if v >= 0 and v <= 23: return [v] elif v == "*": - return range(0, 23) - else: - raise ValueError, "Invalid hour." + return list(range(0, 23)) + else: + raise ValueError("Invalid hour.") elif t == "min": if v >= 0 and v <= 59: return [v] elif v == "*": - return range(0, 59) - else: - raise ValueError, "Invalid minute." + return list(range(0, 59)) + else: + raise ValueError("Invalid minute.") def _validate_list(self, l, t): """ @@ -201,7 +201,7 @@ self._validate_type(v, t) return_list.append(v) except: - raise ValueError, "Names are not allowed in lists." + raise ValueError("Names are not allowed in lists.") # return a list of integers return return_list @@ -218,13 +218,13 @@ elements = r.split('-') # a range should be 2 elements if len(elements) is not 2: - raise ValueError, "Invalid range passed: " + str(r) + raise ValueError("Invalid range passed: " + str(r)) # validate the minimum and maximum are valid for the type for e in elements: self._validate_type(int(e), t) # return a list of the numbers in the range. # +1 makes sure the end point is included in the return value - return range(int(elements[0]), int(elements[1]) + 1) + return list(range(int(elements[0]), int(elements[1]) + 1)) def _validate_step(self, s, t): """ @@ -243,11 +243,11 @@ elements = s.split('/') # a range should be 2 elements if len(elements) is not 2: - raise ValueError, "Invalid step passed: " + str(s) + raise ValueError("Invalid step passed: " + str(s)) try: step = int(elements[1]) except: - raise ValueError, "Invalid step provided " + str(s) + raise ValueError("Invalid step provided " + str(s)) r_list = [] # if the first element is *, use all valid numbers if elements[0] is "*" or elements[0] is "": @@ -263,10 +263,10 @@ try: r_list.extend(int(r)) except: - raise ValueError, "Invalid step provided " + str(s) + raise ValueError("Invalid step provided " + str(s)) elif "-" in elements[0]: r_list.extend(self._validate_range(elements[0], t)) - return range(r_list[0], r_list[-1] + 1, step) + return list(range(r_list[0], r_list[-1] + 1, step)) def _validate_dow(self, dow): """ @@ -299,9 +299,9 @@ elif "-" in dow: return(self._validate_range(dow, "dow")) else: - valid_numbers = range(0, 8) + valid_numbers = list(range(0, 8)) if not int(dow) in valid_numbers: - raise ValueError, "Invalid day of week " + str(dow) + raise ValueError("Invalid day of week " + str(dow)) else: return [int(dow)] @@ -324,7 +324,7 @@ mon = months[mon] return [mon] elif mon is "*": - return range(1, 13) + return list(range(1, 13)) elif "/" in mon: return(self._validate_step(mon, "mon")) elif "," in mon: @@ -332,15 +332,15 @@ elif "-" in mon: return(self._validate_range(mon, "mon")) else: - valid_numbers = range(1, 13) + valid_numbers = list(range(1, 13)) if not int(mon) in valid_numbers: - raise ValueError, "Invalid month " + str(mon) + raise ValueError("Invalid month " + str(mon)) else: return [int(mon)] def _validate_day(self, day): if day is "*": - return range(1, 32) + return list(range(1, 32)) elif "/" in day: return(self._validate_step(day, "day")) elif "," in day: @@ -348,15 +348,15 @@ elif "-" in day: return(self._validate_range(day, "day")) else: - valid_numbers = range(1, 31) + valid_numbers = list(range(1, 31)) if not int(day) in valid_numbers: - raise ValueError, "Invalid day " + str(day) + raise ValueError("Invalid day " + str(day)) else: return [int(day)] def _validate_hour(self, hour): if hour is "*": - return range(0, 24) + return list(range(0, 24)) elif "/" iRefactoringTool: No changes to ./samples/oauth/oauth_on_appengine/appengine_utilities/cache.py RefactoringTool: Refactored ./samples/oauth/oauth_example.py n hour: return(self._validate_step(hour, "hour")) elif "," in hour: @@ -364,15 +364,15 @@ elif "-" in hour: return(self._validate_range(hour, "hour")) else: - valid_numbers = range(0, 23) + valid_numbers = list(range(0, 23)) if not int(hour) in valid_numbers: - raise ValueError, "Invalid hour " + str(hour) + raise ValueError("Invalid hour " + str(hour)) else: return [int(hour)] def _validate_min(self, min): if min is "*": - return range(0, 60) + return list(range(0, 60)) elif "/" in min: return(self._validate_step(min, "min")) elif "," in min: @@ -380,9 +380,9 @@ elif "-" in min: return(self._validate_range(min, "min")) else: - valid_numbers = range(0, 59) + valid_numbers = list(range(0, 59)) if not int(min) in valid_numbers: - raise ValueError, "Invalid min " + str(min) + raise ValueError("Invalid min " + str(min)) else: return [int(min)] --- ./samples/oauth/oauth_example.py (original) +++ ./samples/oauth/oauth_example.py (refactored) @@ -49,11 +49,11 @@ feed: A gdata.docs.DocumentListFeed instance. """ if not feed.entry: - print 'No entries in feed.\n' + print('No entries in feed.\n') docs_list = list(enumerate(feed.entry, start = 1)) for i, entry in docs_list: - print '%d. %s\n' % (i, entry.title.text.encode('UTF-8')) + print('%d. %s\n' % (i, entry.title.text.encode('UTF-8'))) def _ListAllDocuments(self): """Retrieves a list of all of a user's documents and displays them.""" @@ -63,30 +63,30 @@ def Run(self): """Demonstrates usage of OAuth authentication mode and retrieves a list of documents using the Document List Data API.""" - print '\nSTEP 1: Set OAuth input parameters.' + print('\nSTEP 1: Set OAuth input parameters.') self.gd_client.SetOAuthInputParameters( gdata.auth.OAuthSignatureMethod.HMAC_SHA1, self.consumer_key, consumer_secret=self.consumer_secret) - print '\nSTEP 2: Fetch OAuth Request token.' + print('\nSTEP 2: Fetch OAuth Request token.') request_token = self.gd_client.FetchOAuthRequestToken() - print 'Request Token fetched: %s' % request_token - print '\nSTEP 3: Set the fetched OAuth token.' + print('Request Token fetched: %s' % request_token) + print('\nSTEP 3: Set the fetched OAuth token.') self.gd_client.SetOAuthToken(request_token) - print 'OAuth request token set.' - print '\nSTEP 4: Generate OAuth authorization URL.' + print('OAuth request token set.') + print('\nSTEP 4: Generate OAuth authorization URL.') auth_url = self.gd_client.GenerateOAuthAuthorizationURL() - print 'Authorization URL: %s' % auth_url - raw_input('Manually go to the above URL and authenticate.' + print('Authorization URL: %s' % auth_url) + input('Manually go to the above URL and authenticate.' 'Press a key after authorization.') - print '\nSTEP 5: Upgrade to an OAuth access token.' + print('\nSTEP 5: Upgrade to an OAuth access token.') self.gd_client.UpgradeToOAuthAccessToken() - print 'Access Token: %s' % ( - self.gd_client.token_store.find_token(request_token.scopes[0])) - print '\nYour Documents:\n' + print('Access Token: %s' % ( + self.gd_client.token_store.find_token(request_token.scopes[0]))) + print('\nYour Documents:\n') self._ListAllDocuments() - print 'STEP 6: Revoke the OAuth access token after use.' + print('STEP 6: Revoke the OAuth access token after use.') self.gd_client.RevokeOAuthToken() - print 'OAuth access token revoked.' + print('OAuth access token revoked.') def main(): @@ -98,7 +98,7 @@ try: opts, args = getopt.getopt(sys.argv[1:], '', ['consumer_key=', 'consumer_secret=RefactoringTool: Refactored ./samples/oauth/TwoLeggedOAuthExample.py RefactoringTool: Refactored ./samples/oauth/2_legged_oauth.py RefactoringTool: Refactored ./samples/mashups/birthdaySample.py ']) - except getopt.error, msg: + except getopt.error as msg: print ('python oauth_example.py --consumer_key [consumer_key] ' '--consumer_secret [consumer_secret] ') sys.exit(2) @@ -113,9 +113,9 @@ consumer_secret = arg while not consumer_key: - consumer_key = raw_input('Please enter consumer key: ') + consumer_key = input('Please enter consumer key: ') while not consumer_secret: - consumer_secret = raw_input('Please enter consumer secret: ') + consumer_secret = input('Please enter consumer secret: ') sample = OAuthSample(consumer_key, consumer_secret) sample.Run() --- ./samples/oauth/TwoLeggedOAuthExample.py (original) +++ ./samples/oauth/TwoLeggedOAuthExample.py (refactored) @@ -30,10 +30,10 @@ CONSUMER_SECRET = 'YOUR_CONSUMER_KEY' def PrintContacts(client): - print '\nListing contacts for %s...' % client.auth_token.requestor_id + print('\nListing contacts for %s...' % client.auth_token.requestor_id) feed = client.GetContacts() for entry in feed.entry: - print entry.title.text + print(entry.title.text) # Contacts Data API Example ==================================================== @@ -58,12 +58,12 @@ docs_client.ssl = True # POST - upload a document -print "\nUploading doc to %s's account..." % docs_client.auth_token.requestor_id +print("\nUploading doc to %s's account..." % docs_client.auth_token.requestor_id) entry = docs_client.Upload('test.txt', 'MyDocTitle', content_type='text/plain') -print 'Document now accessible online at:', entry.GetAlternateLink().href +print('Document now accessible online at:', entry.GetAlternateLink().href) # GET - fetch the user's document list -print '\nListing Google Docs for %s...' % docs_client.auth_token.requestor_id +print('\nListing Google Docs for %s...' % docs_client.auth_token.requestor_id) feed = docs_client.GetDocList() for entry in feed.entry: - print entry.title.text + print(entry.title.text) --- ./samples/oauth/2_legged_oauth.py (original) +++ ./samples/oauth/2_legged_oauth.py (refactored) @@ -36,18 +36,18 @@ two_legged_oauth=True, requestor_id=requestor_id) # GET - fetch user's contact list -print "\nList of contacts for %s:" % (requestor_id,) +print("\nList of contacts for %s:" % (requestor_id,)) feed = contacts.GetContactsFeed() for entry in feed.entry: - print entry.title.text + print(entry.title.text) # GET - fetch another user's contact list requestor_id = 'another_user@yourdomain.com' -print "\nList of contacts for %s:" % (requestor_id,) +print("\nList of contacts for %s:" % (requestor_id,)) contacts.GetOAuthInputParameters().requestor_id = requestor_id feed = contacts.GetContactsFeed() for entry in feed.entry: - print entry.title.text + print(entry.title.text) # Google Documents List Data API =============================================== @@ -57,16 +57,16 @@ two_legged_oauth=True, requestor_id=requestor_id) # POST - upload a document -print "\nUploading document to %s's Google Documents account:" % (requestor_id,) +print("\nUploading document to %s's Google Documents account:" % (requestor_id,)) ms = gdata.MediaSource( file_path='/path/to/test.txt', content_type=gdata.docs.service.SUPPORTED_FILETYPES['TXT']) # GET - fetch user's document list entry = docs.UploadDocument(ms, 'Company Perks') -print 'Document now accessible online at:', entry.GetAlternateLink().href +print('Document now accessible online at:', entry.GetAlternateLink().href) -print "\nList of Google Documents for %s" % (requestor_id,) +print("\nList of Google Documents for %s" % (requestor_id,)) feed = docs.GetDocumentListFeed() for entry in feed.entry: - print entry.title.text + print(entry.title.text) --- ./samples/mashups/birthdaySample.py (original) +++ ./samples/mashups/birthdaySample.py (refactored) @@ -98,11 +98,11 @@ """ for i, entry in enumerate(feed.entry): if isinstance(feed, gdata.spreadsheet.SpreadsheetsCellsFeed): - print '%s %s\n' % (entry.title.text, entry.content.text) + print('%s %s\n' % (entry.title.teRefactoringTool: Refactored ./samples/finance/test_finance.py xt, entry.content.text)) elif isinstance(feed, gdata.spreadsheet.SpreadsheetsListFeed): - print '%s %s %s\n' % (i, entry.title.text, entry.content.text) + print('%s %s %s\n' % (i, entry.title.text, entry.content.text)) else: - print '%s %s\n' % (i, entry.title.text) + print('%s %s\n' % (i, entry.title.text)) def _PromptForSpreadsheet(self): """ Prompts user to select spreadsheet. @@ -119,7 +119,7 @@ feed = self.s_client.GetSpreadsheetsFeed() self._PrintFeed(feed) - input = raw_input('\nSelection: ') + input = input('\nSelection: ') # extract and return the spreadsheet ID return feed.entry[string.atoi(input)].id.text.rsplit('/', 1)[1] @@ -139,7 +139,7 @@ feed = self.s_client.GetWorksheetsFeed(key) self._PrintFeed(feed) - input = raw_input('\nSelection: ') + input = input('\nSelection: ') # extract and return the worksheet ID return feed.entry[string.atoi(input)].id.text.rsplit('/', 1)[1] @@ -267,7 +267,7 @@ # Need to find at least one instance of name, birthday, photourl # editurl if len(feed.entry) > 0: - for name, custom in feed.entry[0].custom.iteritems(): + for name, custom in feed.entry[0].custom.items(): if custom.column == self.NAME: found_name = True elif custom.column == self.BIRTHDAY: @@ -278,9 +278,9 @@ found_editurl = True if not found_name and found_birthday and found_photourl and found_editurl: - print ("ERROR - Unexpected number of column headers. Should have: %s," + print(("ERROR - Unexpected number of column headers. Should have: %s," " %s, %s, and %s." % (self.NAME, self.BIRTHDAY, self.PHOTO_URL, - self.EDIT_URL)) + self.EDIT_URL))) sys.exit(1) # For every row in the spreadsheet, grab all the data and either insert @@ -293,7 +293,7 @@ d = {} input_valid = True - for name, custom in entry.custom.iteritems(): + for name, custom in entry.custom.items(): d[custom.column] = custom.text month = int(d[self.BIRTHDAY].split("/")[0]) @@ -315,23 +315,23 @@ d[self.BIRTHDAY], d[self.PHOTO_URL]) event = self._InsertBirthdayWebContentEvent(event) event = self._AddReminder(event, self.REMINDER) - print "Added %s's birthday!" % d[self.NAME] + print("Added %s's birthday!" % d[self.NAME]) elif input_valid: # Event already exists edit_link = d[self.EDIT_URL] event = self._CreateBirthdayWebContentEvent(d[self.NAME], d[self.BIRTHDAY], d[self.PHOTO_URL]) event = self.c_client.UpdateEvent(edit_link, event) event = self._AddReminder(event, self.REMINDER) - print "Updated %s's birthday!" % d[self.NAME] + print("Updated %s's birthday!" % d[self.NAME]) if input_valid: d[self.EDIT_URL] = event.GetEditLink().href self.s_client.UpdateRow(entry, d) else: - print "Warning - Skipping row, missing valid input." + print("Warning - Skipping row, missing valid input.") def main(): - email = raw_input("Please enter your email: ") + email = input("Please enter your email: ") password = getpass.getpass("Please enter your password: ") sample = BirthdaySample(email, password) --- ./samples/finance/test_finance.py (original) +++ ./samples/finance/test_finance.py (refactored) @@ -29,11 +29,11 @@ def PrintReturns(pfx, d): """Print returns.""" - print pfx, '%1.5f(1w) %1.5f(4w) %1.5f(3m) %1.5f(YTD)' % tuple( - float(i) for i in (d.return1w, d.return4w, d.return3m, d.returnYTD)) + print(pfx, '%1.5f(1w) %1.5f(4w) %1.5f(3m) %1.5f(YTD)' % tuple( + float(i) for i in (d.return1w, d.return4w, d.return3m, d.returnYTD))) pfx = ' ' * len(pfx) - print pfx, '%1.5f(1y) %1.5f(3y) %1.5f(5y) %1.5f(overall)' % tuple( - float(i) for i in (d.return1y, d.return3y, d.return5y, d.return_overall)) + print(pfx, '%1.5f(1y) %1.5f(3y) %1.5f(5y) %1.5f(overall)' % tuple( + float(i) for i in (d.return1y, d.return3y, d.return5y, d.return_overall))) PrRtn = PrintReturns @@ -41,38 +41,38 @@ def PrintTransactions(transactions): """Print transactions.""" - print " Transactions:" + print(" Transactions:") fmt = ' %4s %-23s %-10s %6s %-11s %-11s' - print fmt % ('ID','Date','Type','Shares','Price','Commission') + print(fmt % ('ID','Date','Type','Shares','Price','Commission')) for txn in transactions: d = txn.transaction_data - print fmt % (txn.transaction_id, d.date or '----', d.type, - d.shares, d.price.money[0], d.commission.money[0]) + print(fmt % (txn.transaction_id, d.date or '----', d.type, + d.shares, d.price.money[0], d.commission.money[0])) if d.notes: - print " Notes:", d.notes - print + print(" Notes:", d.notes) + print() def PrintPosition(pos, with_returns=False): """Print single position.""" - print ' Position :', pos.position_title - print ' Ticker ID :', pos.ticker_id - print ' Symbol :', pos.symbol - print ' Last updated :', pos.updated.text + print(' Position :', pos.position_title) + print(' Ticker ID :', pos.ticker_id) + print(' Symbol :', pos.symbol) + print(' Last updated :', pos.updated.text) d = pos.position_data - print ' Shares :', d.shares + print(' Shares :', d.shares) if with_returns: - print ' Gain % :', d.gain_percentage + print(' Gain % :', d.gain_percentage) PrRtn(' Returns :', d) - print ' Cost basis :', d.cost_basis - print ' Days gain :', d.days_gain - print ' Gain :', d.gain - print ' Market value :', d.market_value - print + print(' Cost basis :', d.cost_basis) + print(' Days gain :', d.days_gain) + print(' Gain :', d.gain) + print(' Market value :', d.market_value) + print() if pos.transactions: - print " \n" + print(" \n") PrintTransactions(pos.transactions) - print " \n" + print(" \n") def PrintPositions(positions, with_returns=False): @@ -82,23 +82,23 @@ def PrintPortfolio(pfl, with_returns=False): """Print single portfolio.""" - print 'Portfolio Title :', pfl.portfolio_title - print 'Portfolio ID :', pfl.portfolio_id - print ' Last updated :', pfl.updated.text + print('Portfolio Title :', pfl.portfolio_title) + print('Portfolio ID :', pfl.portfolio_id) + print(' Last updated :', pfl.updated.text) d = pfl.portfolio_data - print ' Currency :', d.currency_code + print(' Currency :', d.currency_code) if with_returns: - print ' Gain % :', d.gain_percentage + print(' Gain % :', d.gain_percentage) PrRtn(' Returns :', d) - print ' Cost basis :', d.cost_basis - print ' Days gain :', d.days_gain - print ' Gain :', d.gain - print ' Market value :', d.market_value - print + print(' Cost basis :', d.cost_basis) + print(' Days gain :', d.days_gain) + print(' Gain :', d.gain) + print(' Market value :', d.market_value) + print() if pfl.positions: - print " \n" + print(" \n") PrintPositions(pfl.positions, with_returns) - print " \n" + print(" \n") def PrintPortfolios(portfolios, with_returns=False): @@ -108,7 +108,7 @@ def ShowCallDetails(meth): def wrap(*args, **kwargs): - print '@', meth.__name__, args[1:], kwargs + print('@', meth.__name__, args[1:], kwargs) meth(*args, **kwargs) return wrap @@ -177,16 +177,16 @@ pfl_one = 'Portfolio Test: Emerging Markets 12345' pfl_two = 'Portfolio Test: Renewable Energy 31415' - print '---- Deleting portfolios ----' + print('---- Deleting portfolios ----') selRefactoringTool: Refactored ./samples/docs/samplerunner.py f.DeletePortfoliosByName([pfl_one, pfl_two]) PrintPortfolios(self.GetPortfolios()) - print '---- Adding new portfolio ----' + print('---- Adding new portfolio ----') pfl = self.AddPortfolio(pfl_one, 'SGD') PrintPortfolios(self.GetPortfolios()) - print '---- Changing portfolio title and currency code ----' + print('---- Changing portfolio title and currency code ----') pfl = self.UpdatePortfolio(pfl, pfl_two, 'USD') PrintPortfolios(self.GetPortfolios()) - print '---- Deleting portfolio ----' + print('---- Deleting portfolio ----') self.DeletePortfolio(pfl) PrintPortfolios(self.GetPortfolios()) @@ -237,13 +237,13 @@ pfl_title = 'Transaction Test: Technology 27182' self.DeletePortfoliosByName([pfl_title]) - print '---- Adding new portfolio ----' + print('---- Adding new portfolio ----') pfl = self.AddPortfolio(pfl_title, 'USD') PrintPortfolios(self.GetPortfolios()) - print '---- Adding buy transactions ----' + print('---- Adding buy transactions ----') tkr1 = 'NASDAQ:GOOG' - date = datetime.datetime(2009,04,01) + date = datetime.datetime(2009,0o4,0o1) days = datetime.timedelta(1) txn1 = self.Buy(pfl, tkr1, shares=500, price=321.00, date=date) txn2 = self.Buy(pfl, tkr1, shares=150, price=312.00, date=date+15*days) @@ -251,14 +251,14 @@ PrintPosition(pos, with_returns=True) PrintTransactions(self.GetTransactions(pos)) - print '---- Adding sell transactions ----' + print('---- Adding sell transactions ----') txn3 = self.Sell(pfl, tkr1, shares=400, price=322.00, date=date+30*days) txn4 = self.Sell(pfl, tkr1, shares=200, price=330.00, date=date+45*days) pos = self.GetPosition(portfolio=pfl, ticker=tkr1, with_returns=True) PrintPosition(pos, with_returns=True) PrintTransactions(self.GetTransactions(pos)) - print "---- Modifying first and deleting third ----" + print("---- Modifying first and deleting third ----") txn1.transaction_data.shares = '400.0' self.UpdateTransaction(txn1) self.DeleteTransaction(txn3) @@ -266,12 +266,12 @@ PrintPosition(pos, with_returns=True) PrintTransactions(self.GetTransactions(pos)) - print "---- Deleting position ----" - print "Number of positions (before):", len(self.GetPositions(pfl)) + print("---- Deleting position ----") + print("Number of positions (before):", len(self.GetPositions(pfl))) self.DeletePosition(pos) - print "Number of positions (after) :", len(self.GetPositions(pfl)) - - print '---- Deleting portfolio ----' + print("Number of positions (after) :", len(self.GetPositions(pfl))) + + print('---- Deleting portfolio ----') self.DeletePortfolio(pfl) PrintPortfolios(self.GetPortfolios()) @@ -282,7 +282,7 @@ password = sys.argv[2] cases = sys.argv[3:] except IndexError: - print "Usage: test_finance account@google.com password [0 1 2...]" + print("Usage: test_finance account@google.com password [0 1 2...]") sys.exit(1) tester = FinanceTester(email, password) @@ -295,7 +295,7 @@ lambda: tester.TestShowDetails(with_returns=True, inline_positions=True, inline_transactions=True),] if not cases: - cases = range(len(tests)) + cases = list(range(len(tests))) for i in cases: - print "===== TEST CASE", i, "="*50 + print("===== TEST CASE", i, "="*50) tests[int(i)]() --- ./samples/docs/samplerunner.py (original) +++ ./samples/docs/samplerunner.py (refactored) @@ -23,22 +23,22 @@ """Load a source file and run a sample from it.""" source = open(source_file).read() global_dict = {'__file__': source_file} - exec source in global_dict + exec(source, global_dict) samples = [global_dict[k] for k in global_dict if k.endswith('Sample')] lines = source.splitlines() for i, sample in enumerate(samples): - print str(i).rjust(2), sample.__name__, '-', sample.__doc__ + print(str(i).rjust(2), sample.__name__, '-', sample.__doc__) try: - i = int(raw_input('Select sample: ').strip()) + RefactoringTool: Refactored ./samples/docs/docs_v3_example.py i = int(input('Select sample: ').strip()) sample = samples[i] - print '-' * 80 - print 'def', '%s():' % sample.__name__ + print('-' * 80) + print('def', '%s():' % sample.__name__) # print each line until a blank one (or eof). - for line in lines[sample.func_code.co_firstlineno:]: + for line in lines[sample.__code__.co_firstlineno:]: if not line: break - print line - print '-' * 80 + print(line) + print('-' * 80) sample() except (ValueError, IndexError): - print 'Bad selection.' + print('Bad selection.') --- ./samples/docs/docs_v3_example.py (original) +++ ./samples/docs/docs_v3_example.py (refactored) @@ -52,7 +52,7 @@ def PrintResource(resource): """Display a resource to Standard Out.""" - print resource.resource_id.text, resource.GetResourceType() + print(resource.resource_id.text, resource.GetResourceType()) def PrintFeed(feed): @@ -90,7 +90,7 @@ client = CreateClient() for e1 in client.GetResources(limit=5).entry: e2 = client.GetResource(e1) - print 'Refetched: ', e2.title.text, e2.resource_id.text + print('Refetched: ', e2.title.text, e2.resource_id.text) def GetMetadataSample(): @@ -98,21 +98,21 @@ client = CreateClient() # Fetch the metadata entry and display bits of it metadata = client.GetMetadata() - print 'Quota' - print ' Total:', metadata.quota_bytes_total.text - print ' Used:', metadata.quota_bytes_used.text - print ' Trashed:', metadata.quota_bytes_used_in_trash.text - print 'Import / Export' + print('Quota') + print(' Total:', metadata.quota_bytes_total.text) + print(' Used:', metadata.quota_bytes_used.text) + print(' Trashed:', metadata.quota_bytes_used_in_trash.text) + print('Import / Export') for input_format in metadata.import_formats: - print ' Import:', input_format.source, 'to', input_format.target + print(' Import:', input_format.source, 'to', input_format.target) for export_format in metadata.export_formats: - print ' Export:', export_format.source, 'to', export_format.target - print 'Features' + print(' Export:', export_format.source, 'to', export_format.target) + print('Features') for feature in metadata.features: - print ' Feature:', feature.name.text - print 'Upload Sizes' + print(' Feature:', feature.name.text) + print('Upload Sizes') for upload_size in metadata.max_upload_sizes: - print ' Kind:', upload_size.kind, upload_size.text + print(' Kind:', upload_size.kind, upload_size.text) def GetChangesSample(): @@ -120,7 +120,7 @@ client = CreateClient() changes = client.GetChanges() for change in changes.entry: - print change.title.text, change.changestamp.value + print(change.title.text, change.changestamp.value) def GetResourceAclSample(): @@ -129,7 +129,7 @@ for resource in client.GetResources(limit=5).entry: acl_feed = client.GetResourceAcl(resource) for acl in acl_feed.entry: - print acl.role.value, acl.scope.type, acl.scope.value + print(acl.role.value, acl.scope.type, acl.scope.value) def CreateEmptyResourceSample(): @@ -137,7 +137,7 @@ client = CreateClient() document = gdata.docs.data.Resource(type='document', title='My Sample Doc') document = client.CreateResource(document) - print 'Created:', document.title.text, document.resource_id.text + print('Created:', document.title.text, document.resource_id.text) def CreateCollectionSample(): @@ -145,7 +145,7 @@ client = CreateClient() col = gdata.docs.data.Resource(type='folder', title='My Sample Folder') col = client.CreateResource(col) - print 'Created collection:', col.title.text, col.resource_id.text + print('Created collection:', col.title.text, col.resource_id.text) def CreateResourceInCollectionSample(): @@ -153,10 +153,10 @@ client = CreateClient() col = gdata.docs.data.Resource(type='folder', title='My Sample Folder') col = client.CreateResource(col) - print 'Created collection:', col.title.text, col.resource_id.text + print('Created collection:', col.titleRefactoringTool: Refactored ./samples/docs/docs_example.py .text, col.resource_id.text) doc = gdata.docs.data.Resource(type='document', title='My Sample Doc') doc = client.CreateResource(doc, collection=col) - print 'Created:', doc.title.text, doc.resource_id.text + print('Created:', doc.title.text, doc.resource_id.text) def UploadResourceSample(): @@ -168,13 +168,13 @@ 'This is a simple Word document.') # This is a convenient MS Word doc that we know exists path = _GetDataFilePath('test.0.doc') - print 'Selected file at: %s' % path + print('Selected file at: %s' % path) # Create a MediaSource, pointing to the file media = gdata.data.MediaSource() media.SetFileHandle(path, 'application/msword') # Pass the MediaSource when creating the new Resource doc = client.CreateResource(doc, media=media) - print 'Created, and uploaded:', doc.title.text, doc.resource_id.text + print('Created, and uploaded:', doc.title.text, doc.resource_id.text) def UploadUnconvertedFileSample(): @@ -187,7 +187,7 @@ # Pass the convert=false parameter create_uri = gdata.docs.client.RESOURCE_UPLOAD_URI + '?convert=false' doc = client.CreateResource(doc, create_uri=create_uri, media=media) - print 'Created, and uploaded:', doc.title.text, doc.resource_id.text + print('Created, and uploaded:', doc.title.text, doc.resource_id.text) def DeleteResourceSample(): @@ -251,7 +251,7 @@ for entry in client.GetResources(limit=55).entry: revisions = client.GetRevisions(entry) for revision in revisions.entry: - print revision.publish, revision.GetPublishLink() + print(revision.publish, revision.GetPublishLink()) if __name__ == '__main__': --- ./samples/docs/docs_example.py (original) +++ ./samples/docs/docs_example.py (refactored) @@ -67,14 +67,14 @@ Args: feed: A gdata.docs.DocumentListFeed instance. """ - print '\n' + print('\n') if not feed.entry: - print 'No entries in feed.\n' - print '%-18s %-12s %s' % ('TITLE', 'TYPE', 'RESOURCE ID') + print('No entries in feed.\n') + print('%-18s %-12s %s' % ('TITLE', 'TYPE', 'RESOURCE ID')) for entry in feed.entry: - print '%-18s %-12s %s' % (truncate(entry.title.text.encode('UTF-8')), + print('%-18s %-12s %s' % (truncate(entry.title.text.encode('UTF-8')), entry.GetDocumentType(), - entry.resourceId.text) + entry.resourceId.text)) def _GetFileExtension(self, file_name): """Returns the uppercase file extension for a file. @@ -93,54 +93,54 @@ def _UploadMenu(self): """Prompts that enable a user to upload a file to the Document List feed.""" file_path = '' - file_path = raw_input('Enter path to file: ') + file_path = input('Enter path to file: ') if not file_path: return elif not os.path.isfile(file_path): - print 'Not a valid file.' + print('Not a valid file.') return file_name = os.path.basename(file_path) ext = self._GetFileExtension(file_name) if not ext or ext not in gdata.docs.service.SUPPORTED_FILETYPES: - print 'File type not supported. Check the file extension.' + print('File type not supported. Check the file extension.') return else: content_type = gdata.docs.service.SUPPORTED_FILETYPES[ext] title = '' while not title: - title = raw_input('Enter name for document: ') + title = input('Enter name for document: ') try: ms = gdata.MediaSource(file_path=file_path, content_type=content_type) except IOError: - print 'Problems reading file. Check permissions.' + print('Problems reading file. Check permissions.') return if ext in ['CSV', 'ODS', 'XLS', 'XLSX']: - print 'Uploading spreadsheet...' + print('Uploading spreadsheet...') elif ext in ['PPT', 'PPS']: - print 'Uploading presentation...' - else: - print 'Uploading word processor document...' + print('Uploading presentation...') + else: + print('Uploading word processor document...') entry = self.gd_client.Upload(ms, title) if entry: - print 'Upload successful!' - print 'Document now accessible at:', entry.GetAlternateLink().href - else: - print 'Upload error.' + print('Upload successful!') + print('Document now accessible at:', entry.GetAlternateLink().href) + else: + print('Upload error.') def _DownloadMenu(self): """Prompts that enable a user to download a local copy of a document.""" resource_id = '' - resource_id = raw_input('Enter an resource id: ') + resource_id = input('Enter an resource id: ') file_path = '' - file_path = raw_input('Save file to: ') + file_path = input('Save file to: ') if not file_path or not resource_id: return @@ -149,7 +149,7 @@ ext = self._GetFileExtension(file_name) if not ext or ext not in gdata.docs.service.SUPPORTED_FILETYPES: - print 'File type not supported. Check the file extension.' + print('File type not supported. Check the file extension.') return else: content_type = gdata.docs.service.SUPPORTED_FILETYPES[ext] @@ -159,19 +159,19 @@ # When downloading a spreadsheet, the authenticated request needs to be # sent with the spreadsheet service's auth token. if doc_type == 'spreadsheet': - print 'Downloading spreadsheet to %s...' % (file_path,) + print('Downloading spreadsheet to %s...' % (file_path,)) docs_token = self.gd_client.GetClientLoginToken() self.gd_client.SetClientLoginToken(self.gs_client.GetClientLoginToken()) self.gd_client.Export(resource_id, file_path, gid=0) self.gd_client.SetClientLoginToken(docs_token) else: - print 'Downloading document to %s...' % (file_path,) + print('Downloading document to %s...' % (file_path,)) self.gd_client.Export(resource_id, file_path) def _ListDocuments(self): """Retrieves and displays a list of documents based on the user's choice.""" - print 'Retrieve (all/document/folder/presentation/spreadsheet/pdf): ' - category = raw_input('Enter a category: ') + print('Retrieve (all/document/folder/presentation/spreadsheet/pdf): ') + category = input('Enter a category: ') if category == 'all': feed = self.gd_client.GetDocumentListFeed() @@ -187,19 +187,19 @@ def _ListAclPermissions(self): """Retrieves a list of a user's folders and displays them.""" - resource_id = raw_input('Enter an resource id: ') + resource_id = input('Enter an resource id: ') query = gdata.docs.service.DocumentAclQuery(resource_id) - print '\nListing document permissions:' + print('\nListing document permissions:') feed = self.gd_client.GetDocumentListAclFeed(query.ToUri()) for acl_entry in feed.entry: - print '%s - %s (%s)' % (acl_entry.role.value, acl_entry.scope.value, - acl_entry.scope.type) + print('%s - %s (%s)' % (acl_entry.role.value, acl_entry.scope.value, + acl_entry.scope.type)) def _ModifyAclPermissions(self): """Create or updates the ACL entry on an existing document.""" - resource_id = raw_input('Enter an resource id: ') - email = raw_input('Enter an email address: ') - role_value = raw_input('Enter a permission (reader/writer/owner/remove): ') + resource_id = input('Enter an resource id: ') + email = input('Enter an email address: ') + role_value = input('Enter a permission (reader/writer/owner/remove): ') uri = gdata.docs.service.DocumentAclQuery(resource_id).ToUri() acl_feed = self.gd_client.GetDocumentListAclFeed(uri) @@ -227,11 +227,11 @@ inserted_entry = self.gd_client.Post( acl_entry, uri, converter=gdata.docs.DocumentListAclEntryFromString) - print '\nListing document permissions:' + print('\nListing document permissions:') acl_feed = self.gd_client.GetDocumentListAclFeed(uri) for acl_entry in acl_feed.entry: - print '%s - %s (%s)' % (acl_entry.role.value, acl_entry.scope.value, - RefactoringTool: Refactored ./samples/contentforshopping/list_products.py RefactoringTool: Refactored ./samples/contentforshopping/ca_list.py acl_entry.scope.type) + print('%s - %s (%s)' % (acl_entry.role.value, acl_entry.scope.value, + acl_entry.scope.type)) def _FullTextSearch(self): """Searches a user's documents for a text string. @@ -241,7 +241,7 @@ corresponds to the contents of the q parameter in the feed. Note that this parameter searches the content of documents, not just their titles. """ - input = raw_input('Enter search term: ') + input = input('Enter search term: ') query = gdata.docs.service.DocumentQuery(text_query=input) feed = self.gd_client.Query(query.ToUri()) self._PrintFeed(feed) @@ -267,16 +267,16 @@ The integer of the menu item chosen by the user. """ while True: - input = raw_input('> ') + input = input('> ') try: num = int(input) except ValueError: - print 'Invalid choice. Please choose a value between 1 and', max + print('Invalid choice. Please choose a value between 1 and', max) continue if num > max or num < 1: - print 'Invalid choice. Please choose a value between 1 and', max + print('Invalid choice. Please choose a value between 1 and', max) else: return num @@ -300,10 +300,10 @@ elif choice == 6: self._ModifyAclPermissions() elif choice == 7: - print '\nGoodbye.' + print('\nGoodbye.') return except KeyboardInterrupt: - print '\nGoodbye.' + print('\nGoodbye.') return @@ -312,8 +312,8 @@ # Parse command line options try: opts, args = getopt.getopt(sys.argv[1:], '', ['user=', 'pw=']) - except getopt.error, msg: - print 'python docs_example.py --user [username] --pw [password] ' + except getopt.error as msg: + print('python docs_example.py --user [username] --pw [password] ') sys.exit(2) user = '' @@ -327,17 +327,17 @@ pw = arg while not user: - print 'NOTE: Please run these tests only with a test account.' - user = raw_input('Please enter your username: ') + print('NOTE: Please run these tests only with a test account.') + user = input('Please enter your username: ') while not pw: pw = getpass.getpass() if not pw: - print 'Password cannot be blank.' + print('Password cannot be blank.') try: sample = DocsSample(user, pw) except gdata.service.BadAuthentication: - print 'Invalid user credentials given.' + print('Invalid user credentials given.') return sample.Run() --- ./samples/contentforshopping/list_products.py (original) +++ ./samples/contentforshopping/list_products.py (refactored) @@ -19,8 +19,8 @@ from gdata.contentforshopping.client import ContentForShoppingClient # Gather merchant information -account_id = raw_input('Merchant Account ID? ').strip() -email = raw_input('Google Email Address? ').strip() +account_id = input('Merchant Account ID? ').strip() +email = input('Google Email Address? ').strip() # Create a client client = ContentForShoppingClient(account_id) @@ -32,8 +32,8 @@ # Get the products list from the products feed product_feed = client.get_products() -print 'Listing: %s result(s)' % product_feed.total_results.text +print('Listing: %s result(s)' % product_feed.total_results.text) # Each product is an element in the feed's entry (a list) for product in product_feed.entry: - print '- %s: %s' % (product.title.text, product.content.text) + print('- %s: %s' % (product.title.text, product.content.text)) --- ./samples/contentforshopping/ca_list.py (original) +++ ./samples/contentforshopping/ca_list.py (refactored) @@ -19,8 +19,8 @@ from gdata.contentforshopping.client import ContentForShoppingClient # Gather merchant information -account_id = raw_input('Merchant Account ID? ').strip() -email = raw_input('Google Email Address? ').strip() +account_id = input('Merchant Account ID? ').strip() +email = input('Google Email Address? ').strip() # Create a client client = ContentForShoppingClient(account_id) @@ -34,RefactoringTool: Refactored ./samples/contentforshopping/ca_insert.py RefactoringTool: Refactored ./samples/contentforshopping/add_product.py RefactoringTool: Refactored ./samples/contentforshopping/add_batch_products.py RefactoringTool: Refactored ./samples/contacts/unshare_profiles.py RefactoringTool: Refactored ./samples/contacts/profiles_example.py 4 +34,4 @@ # Display the title and self link for each client account for client_account in client_account_feed.entry: - print client_account.title.text, client_account.GetSelfLink().href + print(client_account.title.text, client_account.GetSelfLink().href) --- ./samples/contentforshopping/ca_insert.py (original) +++ ./samples/contentforshopping/ca_insert.py (refactored) @@ -20,8 +20,8 @@ from gdata.contentforshopping.data import ClientAccount, AdultContent # Gather merchant information -account_id = raw_input('Merchant Account ID? ').strip() -email = raw_input('Google Email Address? ').strip() +account_id = input('Merchant Account ID? ').strip() +email = input('Google Email Address? ').strip() # Create a client client = ContentForShoppingClient(account_id) @@ -38,4 +38,4 @@ # Insert the client account client.insert_client_account(client_account) # Display something to the user - print i + 1, '/', 10 + print(i + 1, '/', 10) --- ./samples/contentforshopping/add_product.py (original) +++ ./samples/contentforshopping/add_product.py (refactored) @@ -20,8 +20,8 @@ from gdata.contentforshopping.client import ContentForShoppingClient # Gather merchant information -account_id = raw_input('Merchant Account ID? ').strip() -email = raw_input('Google Email Address? ').strip() +account_id = input('Merchant Account ID? ').strip() +email = input('Google Email Address? ').strip() # Create a client client = ContentForShoppingClient(account_id) --- ./samples/contentforshopping/add_batch_products.py (original) +++ ./samples/contentforshopping/add_batch_products.py (refactored) @@ -20,8 +20,8 @@ from gdata.contentforshopping.client import ContentForShoppingClient # Gather merchant information -account_id = raw_input('Merchant Account ID? ').strip() -email = raw_input('Google Email Address? ').strip() +account_id = input('Merchant Account ID? ').strip() +email = input('Google Email Address? ').strip() # Create a client client = ContentForShoppingClient(account_id) --- ./samples/contacts/unshare_profiles.py (original) +++ ./samples/contacts/unshare_profiles.py (refactored) @@ -125,10 +125,10 @@ manager = ProfilesManager(consumer_key, consumer_secret, admin_email) result = manager.UnshareProfiles() - print 'Success: %s - Error: %s' % (result.success_count, result.error_count) + print('Success: %s - Error: %s' % (result.success_count, result.error_count)) for entry in result.error_entries: - print ' > Failed to update %s: (%s) %s' % ( - entry.id.text, entry.batch_status.code, entry.batch_status.reason) + print(' > Failed to update %s: (%s) %s' % ( + entry.id.text, entry.batch_status.code, entry.batch_status.reason)) sys.exit(0 if not result.error_count else 1) --- ./samples/contacts/profiles_example.py (original) +++ ./samples/contacts/profiles_example.py (refactored) @@ -66,7 +66,7 @@ successive calls to this method. """ if not feed.entry: - print '\nNo entries in feed.\n' + print('\nNo entries in feed.\n') return 0 for entry in feed.entry: self.PrintEntry(entry) @@ -78,39 +78,39 @@ Args: entry: A gdata.contacts.ProfilesEntry """ - print '\n%s' % (entry.title.text) + print('\n%s' % (entry.title.text)) for email in entry.email: if email.primary == 'true': - print 'Email: %s (primary)' % (email.address) + print('Email: %s (primary)' % (email.address)) else: - print 'Email: %s' % (email.address) + print('Email: %s' % (email.address)) if entry.nickname: - print 'Nickname: %s' % (entry.nickname.text) + print('Nickname: %s' % (entry.nickname.text)) if entry.occupation: - print 'Occupation: %s' % (entry.occupation.text) + print('Occupation: %s' % (entry.occupation.text)) if entry.gender: - print 'Gender: %s' % (entry.gender.value) + print('Gender: %s' % (entry.gender.value)) if entry.birthday: - print 'Birthday: %s' % (entry.birthday.when) + print('Birthday: %s' % (entry.birthday.when)) for relation in entry.relation: - print 'Relation: %s %s' % (relation.rel, relation.text) + print('Relation: %s %s' % (relation.rel, relation.text)) for user_defined_field in entry.user_defined_field: - print 'UserDefinedField: %s %s' % (user_defined_field.key, - user_defined_field.value) + print('UserDefinedField: %s %s' % (user_defined_field.key, + user_defined_field.value)) for website in entry.website: - print 'Website: %s %s' % (website.href, website.rel) + print('Website: %s %s' % (website.href, website.rel)) for phone_number in entry.phone_number: - print 'Phone Number: %s' % phone_number.text + print('Phone Number: %s' % phone_number.text) for organization in entry.organization: - print 'Organization:' + print('Organization:') if organization.org_name: - print ' Name: %s' % (organization.org_name.text) + print(' Name: %s' % (organization.org_name.text)) if organization.org_title: - print ' Title: %s' % (organization.org_title.text) + print(' Title: %s' % (organization.org_title.text)) if organization.org_department: - print ' Department: %s' % (organization.org_department.text) + print(' Department: %s' % (organization.org_department.text)) if organization.org_job_description: - print ' Job Desc: %s' % (organization.org_job_description.text) + print(' Job Desc: %s' % (organization.org_job_description.text)) def PrintPaginatedFeed(self, feed, print_method): """Print all pages of a paginated feed. @@ -149,7 +149,7 @@ the current operation should terminate. """ while True: - key_input = raw_input('Continue [Y/n]? ') + key_input = input('Continue [Y/n]? ') if key_input is 'N' or key_input is 'n': return False elif key_input is 'Y' or key_input is 'y' or key_input is '': @@ -161,13 +161,13 @@ self.PrintPaginatedFeed(feed, self.PrintFeed) def SelectProfile(self): - username = raw_input('Please enter your username for the profile: ') + username = input('Please enter your username for the profile: ') entry_uri = self.gd_client.GetFeedUri('profiles')+'/'+username try: entry = self.gd_client.GetProfile(entry_uri) self.PrintEntry(entry) except gdata.service.RequestError: - print 'Invalid username for the profile.' + print('Invalid username for the profile.') def PrintMenu(self): """Displays a menu of options for the user to choose from.""" @@ -186,16 +186,16 @@ The integer of the menu item chosen by the user. """ while True: - key_input = raw_input('> ') + key_input = input('> ') try: num = int(key_input) except ValueError: - print 'Invalid choice. Please choose a value between 1 and', maximum + print('Invalid choice. Please choose a value between 1 and', maximum) continue if num > maximum or num < 1: - print 'Invalid choice. Please choose a value between 1 and', maximum + print('Invalid choice. Please choose a value between 1 and', maximum) else: return num @@ -213,7 +213,7 @@ return except KeyboardInterrupt: - print '\nGoodbye.' + print('\nGoodbye.') return @@ -222,9 +222,9 @@ # Parse command line options try: opts, args = getopt.getopt(sys.argv[1:], '', ['user=', 'pw=', 'domain=']) - except getopt.error, msg: - print 'python profiles_example.py --user [username] --pw [password]' - print ' --domain [domain]' + except getopt.error as msg: + print('python profiles_example.py --user [username] --pw [password]') + print(' --domain [domain]') sys.exit(2) user = '' @@ -241,19 +241,19 @@ domain = arg while not user: - print 'NOTE: Please run these tests only with a test account.' - user = raw_input('Please enter your email: ') + print('NOTE: Please run these tests onlyRefactoringTool: Refactored ./samples/contacts/contacts_example.py with a test account.') + user = input('Please enter your email: ') while not pw: pw = getpass.getpass('Please enter password: ') if not pw: - print 'Password cannot be blank.' + print('Password cannot be blank.') while not domain: - domain = raw_input('Please enter your Apps domain: ') + domain = input('Please enter your Apps domain: ') try: sample = ProfilesSample(user, pw, domain) except gdata.service.BadAuthentication: - print 'Invalid user credentials given.' + print('Invalid user credentials given.') return sample.Run() --- ./samples/contacts/contacts_example.py (original) +++ ./samples/contacts/contacts_example.py (refactored) @@ -62,25 +62,25 @@ """ if not feed.entry: - print '\nNo entries in feed.\n' + print('\nNo entries in feed.\n') return 0 for i, entry in enumerate(feed.entry): - print '\n%s %s' % (ctr+i+1, entry.title.text) + print('\n%s %s' % (ctr+i+1, entry.title.text)) if entry.content: - print ' %s' % (entry.content.text) + print(' %s' % (entry.content.text)) for email in entry.email: if email.primary and email.primary == 'true': - print ' %s' % (email.address) + print(' %s' % (email.address)) # Show the contact groups that this contact is a member of. for group in entry.group_membership_info: - print ' Member of group: %s' % (group.href) + print(' Member of group: %s' % (group.href)) # Display extended properties. for extended_property in entry.extended_property: if extended_property.value: value = extended_property.value else: value = extended_property.GetXmlBlob() - print ' Extended Property %s: %s' % (extended_property.name, value) + print(' Extended Property %s: %s' % (extended_property.name, value)) return len(feed.entry) + ctr def PrintPaginatedFeed(self, feed, print_method): @@ -125,7 +125,7 @@ the current operation should terminate. """ while True: - input = raw_input("Continue [Y/n]? ") + input = input("Continue [Y/n]? ") if input is 'N' or input is 'n': return False elif input is 'Y' or input is 'y' or input is '': @@ -138,50 +138,50 @@ def PrintGroupsFeed(self, feed, ctr): if not feed.entry: - print '\nNo groups in feed.\n' + print('\nNo groups in feed.\n') return 0 for i, entry in enumerate(feed.entry): - print '\n%s %s' % (ctr+i+1, entry.title.text) + print('\n%s %s' % (ctr+i+1, entry.title.text)) if entry.content: - print ' %s' % (entry.content.text) + print(' %s' % (entry.content.text)) # Display the group id which can be used to query the contacts feed. - print ' Group ID: %s' % entry.id.text + print(' Group ID: %s' % entry.id.text) # Display extended properties. for extended_property in entry.extended_property: if extended_property.value: value = extended_property.value else: value = extended_property.GetXmlBlob() - print ' Extended Property %s: %s' % (extended_property.name, value) + print(' Extended Property %s: %s' % (extended_property.name, value)) return len(feed.entry) + ctr def PrintContactsFeed(self, feed, ctr): if not feed.entry: - print '\nNo contacts in feed.\n' + print('\nNo contacts in feed.\n') return 0 for i, entry in enumerate(feed.entry): if not entry.name is None: family_name = entry.name.family_name is None and " " or entry.name.family_name.text full_name = entry.name.full_name is None and " " or entry.name.full_name.text given_name = entry.name.given_name is None and " " or entry.name.given_name.text - print '\n%s %s: %s - %s' % (ctr+i+1, full_name, given_name, family_name) + print('\n%s %s: %s - %s' % (ctr+i+1, full_name, given_name, family_name)) else: - print '\n%s %s (title)' % (ctr+i+1, entry.title.text) + print('\n%s %s (title)' % (ctr+i+1, entry.title.text)) if entry.content: - print ' %s' % (entry.content.text) + print(' %s' % (entry.content.text)) for p in entry.structured_postal_address: - print ' %s' % (p.formatted_address.text) + print(' %s' % (p.formatted_address.text)) # Display the group id which can be used to query the contacts feed. - print ' Group ID: %s' % entry.id.text + print(' Group ID: %s' % entry.id.text) # Display extended properties. for extended_property in entry.extended_property: if extended_property.value: value = extended_property.value else: value = extended_property.GetXmlBlob() - print ' Extended Property %s: %s' % (extended_property.name, value) + print(' Extended Property %s: %s' % (extended_property.name, value)) for user_defined_field in entry.user_defined_field: - print ' User Defined Field %s: %s' % (user_defined_field.key, user_defined_field.value) + print(' User Defined Field %s: %s' % (user_defined_field.key, user_defined_field.value)) return len(feed.entry) + ctr def ListAllGroups(self): @@ -190,9 +190,9 @@ def CreateMenu(self): """Prompts that enable a user to create a contact.""" - name = raw_input('Enter contact\'s name: ') - notes = raw_input('Enter notes for contact: ') - primary_email = raw_input('Enter primary email address: ') + name = input('Enter contact\'s name: ') + notes = input('Enter notes for contact: ') + primary_email = input('Enter primary email address: ') new_contact = gdata.contacts.data.ContactEntry(name=gdata.data.Name(full_name=gdata.data.FullName(text=name))) new_contact.content = atom.data.Content(text=notes) @@ -202,14 +202,14 @@ entry = self.gd_client.CreateContact(new_contact) if entry: - print 'Creation successful!' - print 'ID for the new contact:', entry.id.text + print('Creation successful!') + print('ID for the new contact:', entry.id.text) else: - print 'Upload error.' + print('Upload error.') def QueryMenu(self): """Prompts for updated-min query parameters and displays results.""" - updated_min = raw_input( + updated_min = input( 'Enter updated min (example: 2007-03-16T00:00:00): ') query = gdata.contacts.client.ContactsQuery() query.updated_min = updated_min @@ -218,7 +218,7 @@ def QueryGroupsMenu(self): """Prompts for updated-min query parameters and displays results.""" - updated_min = raw_input( + updated_min = input( 'Enter updated min (example: 2007-03-16T00:00:00): ') query = gdata.contacts.client.ContactsQuery(feed='/m8/feeds/groups/default/full') query.updated_min = updated_min @@ -230,13 +230,13 @@ self.PrintFeed(feed) selection = 5000 while selection > len(feed.entry)+1 or selection < 1: - selection = int(raw_input( + selection = int(input( 'Enter the number for the contact you would like to modify: ')) return feed.entry[selection-1] def UpdateContactMenu(self): selected_entry = self._SelectContact() - new_name = raw_input('Enter a new name for the contact: ') + new_name = input('Enter a new name for the contact: ') if not selected_entry.name: selected_entry.name = gdata.data.Name() selected_entry.name.full_name = gdata.data.FullName(text=new_name) @@ -268,16 +268,16 @@ The integer of the menu item chosen by the user. """ while True: - input = raw_input('> ') + input = input('> ') try: num = int(input) except ValueError: - print 'Invalid choice. Please choose a value between 1 and', max + print('Invalid choice. Please choose a value between 1 and', max) continue if num > max or num < 1: - print 'Invalid choice. Please choose a value between 1 and', max + print('Invalid cRefactoringTool: Refactored ./samples/codesearch/CodesearchExample.py RefactoringTool: Refactored ./samples/calendar_resource/calendar_resource_example.py hoice. Please choose a value between 1 and', max) else: return num @@ -308,7 +308,7 @@ return except KeyboardInterrupt: - print '\nGoodbye.' + print('\nGoodbye.') return @@ -317,8 +317,8 @@ # Parse command line options try: opts, args = getopt.getopt(sys.argv[1:], '', ['user=', 'pw=']) - except getopt.error, msg: - print 'python contacts_example.py --user [username] --pw [password]' + except getopt.error as msg: + print('python contacts_example.py --user [username] --pw [password]') sys.exit(2) user = '' @@ -331,18 +331,18 @@ pw = arg while not user: - print 'NOTE: Please run these tests only with a test account.' - user = raw_input('Please enter your username: ') + print('NOTE: Please run these tests only with a test account.') + user = input('Please enter your username: ') while not pw: pw = getpass.getpass() if not pw: - print 'Password cannot be blank.' + print('Password cannot be blank.') try: sample = ContactsSample(user, pw) except gdata.client.BadAuthentication: - print 'Invalid user credentials given.' + print('Invalid user credentials given.') return sample.Run() --- ./samples/codesearch/CodesearchExample.py (original) +++ ./samples/codesearch/CodesearchExample.py (refactored) @@ -39,13 +39,13 @@ def PrintCodeSnippets(self, query): """Prints the codesearch results for given query.""" feed = self.service.GetSnippetsFeed(query) - print feed.title.text + " Results for '" + query + "'" - print '============================================' + print(feed.title.text + " Results for '" + query + "'") + print('============================================') for entry in feed.entry: - print "" + entry.title.text + print("" + entry.title.text) for match in entry.match: - print "\tline#" + match.line_number + ":" + match.text.replace('\n', '') - print + print("\tline#" + match.line_number + ":" + match.text.replace('\n', '')) + print() def main(): @@ -55,7 +55,7 @@ # parse command line options try: opts, args = getopt.getopt(sys.argv[1:], "", ["query="]) - except getopt.error, msg: + except getopt.error as msg: print ('python CodesearchExample.py --query [query_text]') sys.exit(2) --- ./samples/calendar_resource/calendar_resource_example.py (original) +++ ./samples/calendar_resource/calendar_resource_example.py (refactored) @@ -49,13 +49,13 @@ Args: resource_properties: A dictionary of calendar resource properties """ - print 'Creating a new calendar resource with id %s...' % ( - resource_properties['resource_id']) - print self.client.CreateResource( + print('Creating a new calendar resource with id %s...' % ( + resource_properties['resource_id'])) + print(self.client.CreateResource( resource_id=resource_properties['resource_id'], resource_common_name=resource_properties['resource_name'], resource_description=resource_properties['resource_description'], - resource_type=resource_properties['resource_type']) + resource_type=resource_properties['resource_type'])) def get(self, resource_id=None): """Retrieves the calendar resource with the given resource_id @@ -64,11 +64,11 @@ resource_id: The optional calendar resource identifier """ if resource_id: - print 'Retrieving the calendar resource with id %s...' % (resource_id) - print self.client.GetResource(resource_id=resource_id) + print('Retrieving the calendar resource with id %s...' % (resource_id)) + print(self.client.GetResource(resource_id=resource_id)) else: - print 'Retrieving all calendar resources...' - print self.client.GetResourceFeed() + print('Retrieving all calendar resources...') + print(self.client.GetResourceFeed()) def update(self, resource_properties): """Updates the calendar resource with the given resource_properties @@ -76,13 +76,13 @@ RefactoringTool: Refactored ./samples/calendar/calendarExample.py Args: resource_properties: A dictionary of calendar resource properties """ - print 'Updating the calendar resource with id %s...' % ( - resource_properties['resource_id']) - print self.client.UpdateResource( + print('Updating the calendar resource with id %s...' % ( + resource_properties['resource_id'])) + print(self.client.UpdateResource( resource_id=resource_properties['resource_id'], resource_common_name=resource_properties['resource_name'], resource_description=resource_properties['resource_description'], - resource_type=resource_properties['resource_type']) + resource_type=resource_properties['resource_type'])) def delete(self, resource_id): """Deletes the calendar resource with the given resource_id @@ -90,9 +90,9 @@ Args: resource_id: The unique calendar resource identifier """ - print 'Deleting the calendar resource with id %s...' % (resource_id) + print('Deleting the calendar resource with id %s...' % (resource_id)) self.client.DeleteResource(resource_id) - print 'Calendar resource successfully deleted.' + print('Calendar resource successfully deleted.') def main(): @@ -103,9 +103,9 @@ do_continue = 'y' print("Google Apps Calendar Resource API Sample\n\n") while not domain: - domain = raw_input('Google Apps domain: ') + domain = input('Google Apps domain: ') while not admin_email: - admin_email = '%s@%s' % (raw_input('Administrator username: '), domain) + admin_email = '%s@%s' % (input('Administrator username: '), domain) while not admin_password: admin_password = getpass.getpass('Administrator password: ') @@ -121,7 +121,7 @@ operation = None while operation not in ['c', 'C', 'g', 'G', 'u', 'U', 'd', 'D', 'q', 'Q']: - operation = raw_input('Do [c=create|g=get|u=update|d=delete|q=quit]: ') + operation = input('Do [c=create|g=get|u=update|d=delete|q=quit]: ') operation = operation.lower() @@ -141,7 +141,7 @@ do_continue = None while do_continue not in ['', 'y', 'Y', 'n', 'N']: - do_continue = raw_input('Want to continue (Y/n): ') + do_continue = input('Want to continue (Y/n): ') if do_continue == '': do_continue = 'y' @@ -157,21 +157,21 @@ resource_type = None if operation == 'g': - resource_id = raw_input('Resource id (leave blank to get all resources): ') + resource_id = input('Resource id (leave blank to get all resources): ') else: while not resource_id: - resource_id = raw_input('Resource id: ') + resource_id = input('Resource id: ') if operation == 'c': - resource_name = raw_input('Resource common name (recommended): ') - resource_description = raw_input('Resource description (recommended): ') - resource_type = raw_input('Resource type (recommended): ') + resource_name = input('Resource common name (recommended): ') + resource_description = input('Resource description (recommended): ') + resource_type = input('Resource type (recommended): ') elif operation == 'u': - resource_name = raw_input( + resource_name = input( 'New resource common name (leave blank if no change): ') - resource_description = raw_input( + resource_description = input( 'New resource description (leave blank if no change): ') - resource_type = raw_input('New resource type (leave blank if no change): ') + resource_type = input('New resource type (leave blank if no change): ') resource_properties = {'resource_id': resource_id, 'resource_name': resource_name, --- ./samples/calendar/calendarExample.py (original) +++ ./samples/calendar/calendarExample.py (refactored) @@ -59,9 +59,9 @@ on available attributes.""" feed = self.cal_client.GetAllCalendarsFeed() - print 'Printing allcalendars: %s' % feed.title.text - for i, a_calendar in zip(xrange(len(feed.entry)), feed.entry): - print '\t%s. %s' % (i, a_calendar.title.text,) + print('Printing allcalendars: %s' % feed.title.text) + for i, a_calendar in zip(range(len(feed.entry)), feed.entry): + print('\t%s. %s' % (i, a_calendar.title.text,)) def _PrintOwnCalendars(self): """Retrieves the list of calendars to which the authenticated user @@ -72,9 +72,9 @@ on available attributes.""" feed = self.cal_client.GetOwnCalendarsFeed() - print 'Printing owncalendars: %s' % feed.title.text - for i, a_calendar in zip(xrange(len(feed.entry)), feed.entry): - print '\t%s. %s' % (i, a_calendar.title.text,) + print('Printing owncalendars: %s' % feed.title.text) + for i, a_calendar in zip(range(len(feed.entry)), feed.entry): + print('\t%s. %s' % (i, a_calendar.title.text,)) def _PrintAllEventsOnDefaultCalendar(self): """Retrieves all events on the primary calendar for the authenticated user. @@ -86,14 +86,14 @@ results.""" feed = self.cal_client.GetCalendarEventFeed() - print 'Events on Primary Calendar: %s' % (feed.title.text,) - for i, an_event in zip(xrange(len(feed.entry)), feed.entry): - print '\t%s. %s' % (i, an_event.title.text,) - for p, a_participant in zip(xrange(len(an_event.who)), an_event.who): - print '\t\t%s. %s' % (p, a_participant.email,) - print '\t\t\t%s' % (a_participant.value,) + print('Events on Primary Calendar: %s' % (feed.title.text,)) + for i, an_event in zip(range(len(feed.entry)), feed.entry): + print('\t%s. %s' % (i, an_event.title.text,)) + for p, a_participant in zip(range(len(an_event.who)), an_event.who): + print('\t\t%s. %s' % (p, a_participant.email,)) + print('\t\t\t%s' % (a_participant.value,)) if a_participant.attendee_status: - print '\t\t\t%s' % (a_participant.attendee_status.value,) + print('\t\t\t%s' % (a_participant.attendee_status.value,)) def _FullTextQuery(self, text_query='Tennis'): """Retrieves events from the calendar which match the specified full-text @@ -108,16 +108,16 @@ the Google Calendar API query paramters reference for more info: http://code.google.com/apis/calendar/reference.html#Parameters""" - print 'Full text query for events on Primary Calendar: \'%s\'' % ( - text_query,) + print('Full text query for events on Primary Calendar: \'%s\'' % ( + text_query,)) query = gdata.calendar.client.CalendarEventQuery(text_query=text_query) feed = self.cal_client.GetCalendarEventFeed(q=query) - for i, an_event in zip(xrange(len(feed.entry)), feed.entry): - print '\t%s. %s' % (i, an_event.title.text,) - print '\t\t%s. %s' % (i, an_event.content.text,) + for i, an_event in zip(range(len(feed.entry)), feed.entry): + print('\t%s. %s' % (i, an_event.title.text,)) + print('\t\t%s. %s' % (i, an_event.content.text,)) for a_when in an_event.when: - print '\t\tStart time: %s' % (a_when.start,) - print '\t\tEnd time: %s' % (a_when.end,) + print('\t\tStart time: %s' % (a_when.start,)) + print('\t\tEnd time: %s' % (a_when.end,)) def _DateRangeQuery(self, start_date='2007-01-01', end_date='2007-07-01'): """Retrieves events from the server which occur during the specified date @@ -125,22 +125,22 @@ used to retrieve the feed. For more information on valid query parameters, see: http://code.google.com/apis/calendar/reference.html#Parameters""" - print 'Date range query for events on Primary Calendar: %s to %s' % ( - start_date, end_date,) + print('Date range query for events on Primary Calendar: %s to %s' % ( + start_date, end_date,)) query = gdata.calendar.client.CalendarEventQuery(start_min=start_date, start_max=end_date) feed = self.cal_client.GetCalendarEventFeed(q=query) - for i, an_event in zip(xrange(len(feed.entry)), feed.entry): - print '\t%s. %s' % (i, an_event.title.text,) + for i, an_event in zip(range(len(feed.entry)), feed.entry): + print('\t%s. %s' % (i, an_event.title.text,)) for a_when in an_event.when: - print '\t\tStart time: %s' % (a_when.start,) - print '\t\tEnd time: %s' % (a_when.end,) + print('\t\tStart time: %s' % (a_when.start,)) + print('\t\tEnd time: %s' % (a_when.end,)) def _InsertCalendar(self, title='Little League Schedule', description='This calendar contains practice and game times', time_zone='America/Los_Angeles', hidden=False, location='Oakland', color='#2952A3'): """Creates a new calendar using the specified data.""" - print 'Creating new calendar with title "%s"' % title + print('Creating new calendar with title "%s"' % title) calendar = gdata.calendar.data.CalendarEntry() calendar.title = atom.data.Title(text=title) calendar.summary = atom.data.Summary(text=description) @@ -158,8 +158,8 @@ def _UpdateCalendar(self, calendar, title='New Title', color=None): """Updates the title and, optionally, the color of the supplied calendar""" - print 'Updating the calendar titled "%s" with the title "%s"' % ( - calendar.title.text, title) + print('Updating the calendar titled "%s" with the title "%s"' % ( + calendar.title.text, title)) calendar.title = atom.data.Title(text=title) if color is not None: calendar.color = gdata.calendar.data.ColorProperty(value=color) @@ -171,19 +171,19 @@ """Deletes all calendars. Note: the primary calendar cannot be deleted""" feed = self.cal_client.GetOwnCalendarsFeed() for entry in feed.entry: - print 'Deleting calendar: %s' % entry.title.text + print('Deleting calendar: %s' % entry.title.text) try: self.cal_client.Delete(entry.GetEditLink().href) - except gdata.client.RequestError, msg: + except gdata.client.RequestError as msg: if msg.body.startswith('Cannot remove primary calendar'): - print '\t%s' % msg.body + print('\t%s' % msg.body) else: - print '\tUnexpected Error: %s' % msg.body + print('\tUnexpected Error: %s' % msg.body) def _InsertSubscription(self, id='python.gcal.test%40gmail.com'): """Subscribes to the calendar with the specified ID.""" - print 'Subscribing to the calendar with ID: %s' % id + print('Subscribing to the calendar with ID: %s' % id) calendar = gdata.calendar.data.CalendarEntry() calendar.id = atom.data.Id(text=id) returned_calendar = self.cal_client.InsertCalendarSubscription(calendar) @@ -193,7 +193,7 @@ id='python.gcal.test%40gmail.com', color=None, hidden=None, selected=None): """Updates the subscription to the calendar with the specified ID.""" - print 'Updating the calendar subscription with ID: %s' % id + print('Updating the calendar subscription with ID: %s' % id) calendar_url = ( 'http://www.google.com/calendar/feeds/default/allcalendars/full/%s' % id) calendar_entry = self.cal_client.GetCalendarEntry(calendar_url) @@ -217,7 +217,7 @@ def _DeleteCalendarSubscription(self, id='python.gcal.test%40gmail.com'): """Deletes the subscription to the calendar with the specified ID.""" - print 'Deleting the calendar subscription with ID: %s' % id + print('Deleting the calendar subscription with ID: %s' % id) calendar_url = ( 'http://www.google.com/calendar/feeds/default/allcalendars/full/%s' % id) calendar_entry = self.cal_client.GetCalendarEntry(calendar_url) @@ -268,9 +268,9 @@ new_event = self._InsertEvent(title, content, where, start_time, end_time, recurrence_data=None) - print 'New single event inserted: %s' % (new_event.id.text,) - print '\tEvent edit URL: %s' % (new_event.GetEditLink().href,) - print '\tEvent HTML URL: %s' % (new_event.GetHtmlLink().href,) + print('New single event inserted: %s' % (new_event.id.text,)) + print('\tEvent edit URL: %s' % (new_event.GetEditLink().href,)) + print('\tEvent HTML URL: %s' % (new_event.GetHtmlLink().href,)) return new_event @@ -294,9 +294,9 @@ new_event = self._InsertEvent(title, content, where, recurrence_data=recurrence_data, start_time=None, end_time=None) - print 'New recurring event inserted: %s' % (new_event.id.text,) - print '\tEvent edit URL: %s' % (new_event.GetEditLink().href,) - print '\tEvent HTML URL: %s' % (new_event.GetHtmlLink().href,) + print('New recurring event inserted: %s' % (new_event.id.text,)) + print('\tEvent edit URL: %s' % (new_event.GetEditLink().href,)) + print('\tEvent HTML URL: %s' % (new_event.GetHtmlLink().href,)) return new_event @@ -331,7 +331,7 @@ event = gdata.calendar.data.CalendarEventEntry() event.link.append(web_content_link) - print 'Inserting Simple Web Content Event' + print('Inserting Simple Web Content Event') new_event = self.cal_client.InsertEvent(event) return new_event @@ -358,7 +358,7 @@ event = gdata.calendar.data.CalendarEventEntry() event.link.append(web_content_link) - print 'Inserting Web Content Gadget Event' + print('Inserting Web Content Gadget Event') new_event = self.cal_client.InsertEvent(event) return new_event @@ -376,8 +376,8 @@ previous_title = event.title.text event.title.text = new_title - print 'Updating title of event from:\'%s\' to:\'%s\'' % ( - previous_title, event.title.text,) + print('Updating title of event from:\'%s\' to:\'%s\'' % ( + previous_title, event.title.text,)) return self.cal_client.Update(event) def _AddReminder(self, event, minutes=10): @@ -393,7 +393,7 @@ else: a_when.reminder.append(gdata.data.Reminder(minutes=str(minutes))) - print 'Adding %d minute reminder to event' % (minutes,) + print('Adding %d minute reminder to event' % (minutes,)) return self.cal_client.Update(event) def _AddExtendedProperty(self, event, @@ -406,7 +406,7 @@ event.extended_property.append( gdata.calendar.data.CalendarExtendedProperty(name=name, value=value)) - print 'Adding extended property to event: \'%s\'=\'%s\'' % (name, value,) + print('Adding extended property to event: \'%s\'=\'%s\'' % (name, value,)) return self.cal_client.Update(event) def _DeleteEvent(self, event): @@ -422,11 +422,11 @@ feed returned in the response.""" feed = self.cal_client.GetCalendarAclFeed() - print feed.title.text - for i, a_rule in zip(xrange(len(feed.entry)), feed.entry): - print '\t%s. %s' % (i, a_rule.title.text,) - print '\t\t Role: %s' % (a_rule.role.value,) - print '\t\t Scope %s - %s' % (a_rule.scope.type, a_rule.scope.value) + print(feed.title.text) + for i, a_rule in zip(range(len(feed.entry)), feed.entry): + print('\t%s. %s' % (i, a_rule.title.text,)) + print('\t\t Role: %s' % (a_rule.role.value,)) + print('\t\t Scope %s - %s' % (a_rule.scope.type, a_rule.scope.value)) def _CreateAclRule(self, username): """Creates a ACL rule that grants the given user permission to view @@ -434,7 +434,7 @@ to specify a title for the ACL entry. The server will set this to be the value of the role specified (in this case "freebusy").""" - print 'Creating Acl rule for user: %s' % username + print('Creating Acl rule for user: %s' % username) rule = gdata.calendar.data.CalendarAclEntry() rule.scope = gdata.acl.data.AclScope(value=username, type="user") roleValue = "http://schemas.google.com/gCal/2005#%s" % ("freebusy") @@ -450,9 +450,9 @@ aclEntryUri = "http://www.google.com/calendar/feeds/" aclEntryUri += "default/acl/full/user:%s" % (username) entry = self.cal_client.GetCalendarAclEntry(aclEntryUri) - print '\t%s' % (entry.title.text,) - print '\t\t Role: %s' % (entry.role.value,) - print '\t\t Scope %s - %s' % (entry.scope.type, entry.scope.value) + print('\t%s' % (entry.title.text,)) + print('\t\t Role: %s' % (entry.role.value,)) + print('\t\t Scope %s - %s' % (entry.scope.type, entry.scope.value)) return entry def _UpdateAclRule(self, entry): @@ -460,7 +460,7 @@ entry. Note that while the role of an ACL entry can be updated, the scope can not be modified.""" - print 'Update Acl rule: %s' % (enRefactoringTool: Refactored ./samples/blogger/oauth-appengine/oauth.py RefactoringTool: Refactored ./samples/blogger/oauth-appengine/main.py RefactoringTool: No changes to ./samples/blogger/app/blogapp.py RefactoringTool: Refactored ./samples/blogger/BloggerExampleV1.py try.GetEditLink().href) + print('Update Acl rule: %s' % (entry.GetEditLink().href)) roleValue = "http://schemas.google.com/gCal/2005#%s" % ("read") entry.role = gdata.acl.data.AclRole(value=roleValue) returned_rule = self.cal_client.Update(entry) @@ -475,7 +475,7 @@ def _batchRequest(self, updateEntry, deleteEntry): """Execute a batch request to create, update and delete an entry.""" - print 'Executing batch request to insert, update and delete entries.' + print('Executing batch request to insert, update and delete entries.') # feed that holds all the batch rquest entries request_feed = gdata.calendar.data.CalendarEventFeed() @@ -509,9 +509,9 @@ # iterate the response feed to get the operation status for entry in response_feed.entry: - print '\tbatch id: %s' % (entry.batch_id.text,) - print '\tstatus: %s' % (entry.batch_status.code,) - print '\treason: %s' % (entry.batch_status.reason,) + print('\tbatch id: %s' % (entry.batch_id.text,)) + print('\tstatus: %s' % (entry.batch_status.code,)) + print('\treason: %s' % (entry.batch_status.reason,)) if entry.batch_id.text == 'insert-request': insertEntry = entry elif entry.batch_id.text == 'update-request': @@ -567,15 +567,15 @@ # Delete entries if delete argument='true' if delete == 'true': - print 'Deleting created events' + print('Deleting created events') self.cal_client.Delete(see_u_ext_prop) self.cal_client.Delete(ree) self.cal_client.Delete(simple_web_content_event) self.cal_client.Delete(web_content_gadget_event) self.cal_client.Delete(quick_add_event) - print 'Deleting subscriptions' + print('Deleting subscriptions') self._DeleteCalendarSubscription() - print 'Deleting all calendars' + print('Deleting all calendars') self._DeleteAllCalendars() @@ -587,9 +587,9 @@ # parse command line options try: opts, args = getopt.getopt(sys.argv[1:], "", ["user=", "pw=", "delete="]) - except getopt.error, msg: - print ('python calendarExample.py --user [username] --pw [password] ' + - '--delete [true|false] ') + except getopt.error as msg: + print(('python calendarExample.py --user [username] --pw [password] ' + + '--delete [true|false] ')) sys.exit(2) user = '' @@ -606,8 +606,8 @@ delete = a if user == '' or pw == '': - print ('python calendarExample.py --user [username] --pw [password] ' + - '--delete [true|false] ') + print(('python calendarExample.py --user [username] --pw [password] ' + + '--delete [true|false] ')) sys.exit(2) sample = CalendarExample(user, pw) --- ./samples/blogger/oauth-appengine/oauth.py (original) +++ ./samples/blogger/oauth-appengine/oauth.py (refactored) @@ -164,7 +164,7 @@ if self.client.has_access_token(): try: fun(self, *args, **kwargs) - except gdata.service.RequestError, error: + except gdata.service.RequestError as error: if error.code in [401, 403]: self.redirect('/oauth/request_token') else: --- ./samples/blogger/oauth-appengine/main.py (original) +++ ./samples/blogger/oauth-appengine/main.py (refactored) @@ -32,7 +32,7 @@ 'updated': entry.updated.text }) template_values['blogs'] = blogs - except gdata.service.RequestError, error: + except gdata.service.RequestError as error: template_values['logged'] = False path = os.path.join(os.path.dirname(__file__), 'index.html') --- ./samples/blogger/BloggerExampleV1.py (original) +++ ./samples/blogger/BloggerExampleV1.py (refactored) @@ -70,10 +70,10 @@ feed = self.service.Get(query.ToUri()) # Print the results. - print feed.title.text + print(feed.title.text) for entry in feed.entry: - print "\t" + entry.title.text - print + print("\t" + entry.title.text) + print() def CreatePost(self, title, content, author_name, is_draft): """This method creates a new post on a blog. The new post can be stored as @@ -108,13 +108,13 @@ feed = self.service.GetFeed('/feeds/' + self.blog_id + '/posts/default') # Print the results. - print feed.title.text + print(feed.title.text) for entry in feed.entry: if not entry.title.text: - print "\tNo Title" + print("\tNo Title") else: - print "\t" + entry.title.text - print + print("\t" + entry.title.text) + print() def PrintPostsInDateRange(self, start_time, end_time): """This method displays the title and modification time for any posts that @@ -139,14 +139,14 @@ feed = self.service.Get(query.ToUri()) # Print the results. - print feed.title.text + " posts between " + start_time + " and " + end_time - print feed.title.text + print(feed.title.text + " posts between " + start_time + " and " + end_time) + print(feed.title.text) for entry in feed.entry: if not entry.title.text: - print "\tNo Title" + print("\tNo Title") else: - print "\t" + entry.title.text - print + print("\t" + entry.title.text) + print() def UpdatePostTitle(self, entry_to_update, new_title): """This method updates the title of the given post. The GDataEntry object @@ -199,11 +199,11 @@ feed = self.service.Get(feed_url) # Display the results - print feed.title.text + print(feed.title.text) for entry in feed.entry: - print "\t" + entry.title.text - print "\t" + entry.updated.text - print + print("\t" + entry.title.text) + print("\t" + entry.updated.text) + print() def DeleteComment(self, post_id, comment_id): """This method removes the comment specified by the given edit_link_href, the @@ -232,24 +232,24 @@ draft_post = self.CreatePost("Snorkling in Aruba", "

We had so much fun snorkling in Aruba

", "Post author", True) - print "Successfully created draft post: \"" + draft_post.title.text + "\".\n" + print("Successfully created draft post: \"" + draft_post.title.text + "\".\n") # Demonstrate how to publish a public post. public_post = self.CreatePost("Back from vacation", "

I didn't want to leave Aruba, but I ran out of money :(

", "Post author", False) - print "Successfully created public post: \"" + public_post.title.text + "\".\n" + print("Successfully created public post: \"" + public_post.title.text + "\".\n") # Demonstrate various feed queries. - print "Now listing all posts." + print("Now listing all posts.") self.PrintAllPosts() - print "Now listing all posts between 2007-04-04 and 2007-04-23." + print("Now listing all posts between 2007-04-04 and 2007-04-23.") self.PrintPostsInDateRange("2007-04-04", "2007-04-23") # Demonstrate updating a post's title. - print "Now updating the title of the post we just created:" + print("Now updating the title of the post we just created:") public_post = self.UpdatePostTitle(public_post, "The party's over") - print "Successfully changed the post's title to \"" + public_post.title.text + "\".\n" + print("Successfully changed the post's title to \"" + public_post.title.text + "\".\n") # Demonstrate how to retrieve the comments for a post. @@ -258,28 +258,28 @@ tokens = self_id.split("-") post_id = tokens[-1] - print "Now posting a comment on the post titled: \"" + public_post.title.text + "\"." + print("Now posting a comment on the post titled: \"" + public_post.title.text + "\".") comment = self.CreateComment(post_id, "Did you see any sharks?") - print "Successfully posted \"" + comment.content.text + "\" on the post titled: \"" + public_post.title.text + "\".\n" + print("Successfully posted \"" + comment.content.text + "\" on the post titled: \"" + public_post.title.text + "\".\n") comment_id = comment.GetEditLink().href.split("/")[-1] - print "Now printing all comments" + print("Now printing all comments") self.PrintAllCommRefactoringTool: Refactored ./samples/blogger/BloggerExample.py ents(post_id) # Delete the comment we just posted - print "Now deleting the comment we just posted" + print("Now deleting the comment we just posted") self.DeleteComment(post_id, comment_id) - print "Successfully deleted comment." + print("Successfully deleted comment.") self.PrintAllComments(post_id) # Get the post's edit URI edit_uri = public_post.GetEditLink().href # Demonstrate deleting posts. - print "Now deleting the post titled: \"" + public_post.title.text + "\"." + print("Now deleting the post titled: \"" + public_post.title.text + "\".") self.DeletePost(edit_uri) - print "Successfully deleted post." + print("Successfully deleted post.") self.PrintAllPosts() @@ -291,7 +291,7 @@ # parse command line options try: opts, args = getopt.getopt(sys.argv[1:], "", ["email=", "password="]) - except getopt.error, msg: + except getopt.error as msg: print ('python BloggerExample.py --email [email] --password [password] ') sys.exit(2) --- ./samples/blogger/BloggerExample.py (original) +++ ./samples/blogger/BloggerExample.py (refactored) @@ -65,10 +65,10 @@ feed = self.client.get_blogs() # Print the results. - print feed.title.text - for entry in feed.entry: - print "\t" + entry.title.text - print + print(feed.title.text) + for entry in feed.entry: + print("\t" + entry.title.text) + print() def CreatePost(self, title, content, is_draft): """This method creates a new post on a blog. The new post can be stored as @@ -90,13 +90,13 @@ feed = self.client.get_posts(self.blog_id) # Print the results. - print feed.title.text + print(feed.title.text) for entry in feed.entry: if not entry.title.text: - print "\tNo Title" + print("\tNo Title") else: - print "\t" + entry.title.text.encode('utf-8') - print + print("\t" + entry.title.text.encode('utf-8')) + print() def PrintPostsInDateRange(self, start_time, end_time): """This method displays the title and modification time for any posts that @@ -116,19 +116,19 @@ query = gdata.blogger.client.Query(updated_min=start_time, updated_max=end_time, order_by='updated') - print query.updated_min - print query.order_by + print(query.updated_min) + print(query.order_by) feed = self.client.get_posts(self.blog_id, query=query) # Print the results. - print feed.title.text + " posts between " + start_time + " and " + end_time - print feed.title.text + print(feed.title.text + " posts between " + start_time + " and " + end_time) + print(feed.title.text) for entry in feed.entry: if not entry.title.text: - print "\tNo Title" + print("\tNo Title") else: - print "\t" + entry.title.text - print + print("\t" + entry.title.text) + print() def UpdatePostTitle(self, entry_to_update, new_title): """This method updates the title of the given post. The GDataEntry object @@ -168,11 +168,11 @@ feed = self.client.get_post_comments(self.blog_id, post_id) # Display the results - print feed.title.text - for entry in feed.entry: - print "\t" + entry.title.text - print "\t" + entry.updated.text - print + print(feed.title.text) + for entry in feed.entry: + print("\t" + entry.title.text) + print("\t" + entry.updated.text) + print() def DeleteComment(self, comment_entry): """This method removes the comment specified by the given edit_link_href, the @@ -199,7 +199,7 @@ draft_post = self.CreatePost('Snorkling in Aruba', '

We had so much fun snorkling in Aruba

', True) - print 'Successfully created draft post: "' + draft_post.title.text + '".\n' + print('Successfully created draft post: "' + draft_post.title.text + '".\n') # Delete the draft blog post. self.client.delete(draft_post) @@ -208,43 +208,43RefactoringTool: Refactored ./samples/authsub/secure_authsub.py RefactoringTool: Refactored ./samples/apps/userprovisioning_quick_start_example.py @@ public_post = self.CreatePost("Back from vacation", "

I didn't want to leave Aruba, but I ran out of money :(

", False) - print "Successfully created public post: \"" + public_post.title.text + "\".\n" + print("Successfully created public post: \"" + public_post.title.text + "\".\n") # Demonstrate various feed queries. - print "Now listing all posts." + print("Now listing all posts.") self.PrintAllPosts() - print "Now listing all posts between 2007-04-04 and 2007-04-23." + print("Now listing all posts between 2007-04-04 and 2007-04-23.") self.PrintPostsInDateRange("2007-04-04", "2007-04-23") # Demonstrate updating a post's title. - print "Now updating the title of the post we just created:" + print("Now updating the title of the post we just created:") public_post = self.UpdatePostTitle(public_post, "The party's over") - print "Successfully changed the post's title to \"" + public_post.title.text + "\".\n" + print("Successfully changed the post's title to \"" + public_post.title.text + "\".\n") # Demonstrate how to retrieve the comments for a post. # Get the post ID and build the comments feed URI for the specified post post_id = public_post.get_post_id() - print "Now posting a comment on the post titled: \"" + public_post.title.text + "\"." + print("Now posting a comment on the post titled: \"" + public_post.title.text + "\".") comment = self.CreateComment(post_id, "Did you see any sharks?") - print "Successfully posted \"" + comment.content.text + "\" on the post titled: \"" + public_post.title.text + "\".\n" + print("Successfully posted \"" + comment.content.text + "\" on the post titled: \"" + public_post.title.text + "\".\n") comment_id = comment.GetCommentId() - print "Now printing all comments" + print("Now printing all comments") self.PrintAllComments(post_id) # Delete the comment we just posted - print "Now deleting the comment we just posted" + print("Now deleting the comment we just posted") self.DeleteComment(comment) - print "Successfully deleted comment." + print("Successfully deleted comment.") self.PrintAllComments(post_id) # Demonstrate deleting posts. - print "Now deleting the post titled: \"" + public_post.title.text + "\"." + print("Now deleting the post titled: \"" + public_post.title.text + "\".") self.DeletePost(public_post) - print "Successfully deleted post." + print("Successfully deleted post.") self.PrintAllPosts() --- ./samples/authsub/secure_authsub.py (original) +++ ./samples/authsub/secure_authsub.py (refactored) @@ -33,7 +33,7 @@ import os import sys -import urllib +import urllib.request, urllib.parse, urllib.error import gdata.auth import gdata.service @@ -85,7 +85,7 @@ request_url=self.H9_AUTHSUB_HANDLER, include_scopes_in_next=include_scopes_in_next) if extra_params: - auth_sub_url = '%s&%s' % (auth_sub_url, urllib.urlencode(extra_params)) + auth_sub_url = '%s&%s' % (auth_sub_url, urllib.parse.urlencode(extra_params)) return auth_sub_url def SetPrivateKey(self, filename): @@ -107,7 +107,8 @@ f = open(filename) rsa_private_key = f.read() f.close() - except IOError, (errno, strerror): + except IOError as xxx_todo_changeme: + (errno, strerror) = xxx_todo_changeme.args raise 'I/O error(%s): %s' % (errno, strerror) self.rsa_key = rsa_private_key return rsa_private_key @@ -176,7 +177,7 @@ # Query the Health Data API params = {'digest': 'true', 'strict': 'true'} - uri = '%s?%s' % (H9_PROFILE_FEED_URL, urllib.urlencode(params)) + uri = '%s?%s' % (H9_PROFILE_FEED_URL, urllib.parse.urlencode(params)) feed = client.GetFeed(uri) req.write('

Listing medications

') --- ./samples/apps/userprovisioning_quick_start_example.py (original) +++ ./samples/apps/userprovisioning_quick_start_example.py (refactored) @@ -61,10 +61,10 @@ client_id=self.client_id, client_secret=self.client_secret, scope=SCOPE, user_agent=USER_AGENT) uri = self.token.generate_authorize_url() - print 'Please visit this URL to authorize the application:' - print uri + print('Please visit this URL to authorize the application:') + print(uri) # Get the verification code from the standard input. - code = raw_input('What is the verification code? ').strip() + code = input('What is the verification code? ').strip() self.token.get_access_token(code) self.client = gdata.apps.client.AppsClient( domain=self.domain, auth_token=self.token) @@ -75,13 +75,13 @@ Args: entry: [UserEntry] User entry corresponding to a user """ - print '\nGiven Name: %s' % (entry.name.given_name) - print 'Family Name: %s' % (entry.name.family_name) - print 'Username: %s' % (entry.login.user_name) - print 'Is Admin: %s' % (entry.login.admin) - print 'Is Suspended: %s' % (entry.login.suspended) - print 'Change password at next login: %s\n' % ( - entry.login.change_password) + print('\nGiven Name: %s' % (entry.name.given_name)) + print('Family Name: %s' % (entry.name.family_name)) + print('Username: %s' % (entry.login.user_name)) + print('Is Admin: %s' % (entry.login.admin)) + print('Is Suspended: %s' % (entry.login.suspended)) + print('Change password at next login: %s\n' % ( + entry.login.change_password)) def _PrintNicknameDetails(self, entry): """Prints the attributes for a user nickname entry. @@ -89,11 +89,11 @@ Args: entry: [NicknameEntry] """ - print 'Username: %s' % (entry.login.user_name) - print 'Nickname: %s\n' % (entry.nickname.name) + print('Username: %s' % (entry.login.user_name)) + print('Nickname: %s\n' % (entry.nickname.name)) def _GetChoice(self, for_value): - choice = raw_input(('(Optional) Enter a choice for %s\n' + choice = input(('(Optional) Enter a choice for %s\n' '1-True 2-False ') % (for_value)) if choice == '1': return True @@ -105,11 +105,11 @@ user_name = given_name = family_name = password = None confirm_password = '' while not user_name: - user_name = raw_input('Enter a new username: ') + user_name = input('Enter a new username: ') while not given_name: - given_name = raw_input('Enter given name for the user: ') + given_name = input('Enter given name for the user: ') while not family_name: - family_name = raw_input('Enter family name for the user: ') + family_name = input('Enter family name for the user: ') while not password == confirm_password: password = '' while not password: @@ -118,16 +118,16 @@ if password.__len__() == 0: break if password.__len__() < 8: - print 'Password must be at least 8 characters long' + print('Password must be at least 8 characters long') password = '' sys.stdout.write('Confirm password: ') confirm_password = getpass.getpass() is_admin = self._GetChoice('is_admin ') - hash_function = raw_input('(Optional) Enter a hash function ') + hash_function = input('(Optional) Enter a hash function ') suspended = self._GetChoice('suspended ') change_password = self._GetChoice('change_password ') - quota = raw_input('(Optional) Enter a quota ') + quota = input('(Optional) Enter a quota ') if quota == 'None' or not quota.isdigit(): quota = None @@ -137,24 +137,24 @@ password_hash_function=hash_function, change_password=change_password) self._PrintUserDetails(user_entry) - print 'User Created' + print('User Created') def _UpdateUser(self): """Updates a user.""" - user_name = raw_input('Enter the username ') + user_name = input('Enter the username ') if user_name is None: - print 'Username missing\n' + print('Username missing\n') return user_entry = self.client.RetrieveUser(user_name=user_name) - print self._PrintUserDetails(user_entry) + print(self._PrintUserDetails(user_entry)) attributes = {1: 'given_name', 2: 'family_name', 3: 'user_name', 4: 'suspended', 5: 'is_admin'} - print attributes - attr = int(raw_input('\nEnter number(1-5) of attribute to be updated ')) - - updated_val = raw_input('Enter updated value ') + print(attributes) + attr = int(input('\nEnter number(1-5) of attribute to be updated ')) + + updated_val = input('Enter updated value ') if attr == 1: user_entry.name.given_name = updated_val if attr == 2: @@ -172,9 +172,9 @@ def _RetrieveSingleUser(self): """Retrieves a single user.""" - user_name = raw_input('Enter the username ') + user_name = input('Enter the username ') if user_name is None: - print 'Username missing\n' + print('Username missing\n') return response = self.client.RetrieveUser(user_name=user_name) self._PrintUserDetails(response) @@ -189,33 +189,33 @@ def _DeleteUser(self): """Deletes a user.""" - user_name = raw_input('Enter the username ') + user_name = input('Enter the username ') if user_name is None: - print 'Username missing\n' + print('Username missing\n') return self.client.DeleteUser(user_name=user_name) - print 'User Deleted' + print('User Deleted') def _CreateNickname(self): """Creates a user alias.""" - user_name = raw_input('Enter the username ') - nickname = raw_input('Enter a nickname for user ') + user_name = input('Enter the username ') + nickname = input('Enter a nickname for user ') if None in (user_name, nickname): - print 'Username/Nickname missing\n' + print('Username/Nickname missing\n') return nickname = self.client.CreateNickname( user_name=user_name, nickname=nickname) - print nickname - print 'Nickname Created' + print(nickname) + print('Nickname Created') def _RetrieveNickname(self): """Retrieves a nickname entry.""" - nickname = raw_input('Enter the username ') + nickname = input('Enter the username ') if nickname is None: - print 'Nickname missing\n' + print('Nickname missing\n') return response = self.client.RetrieveNickname(nickname=nickname) self._PrintNicknameDetails(response) @@ -223,9 +223,9 @@ def _RetrieveUserNicknames(self): """Retrieves all nicknames of a user.""" - user_name = raw_input('Enter the username ') + user_name = input('Enter the username ') if user_name is None: - print 'Username missing\n' + print('Username missing\n') return response = self.client.RetrieveNicknames(user_name=user_name) for entry in response.entry: @@ -234,12 +234,12 @@ def _DeleteNickname(self): """Deletes a nickname.""" - nickname = raw_input('Enter the username ') + nickname = input('Enter the username ') if nickname is None: - print 'Nickname missing\n' + print('Nickname missing\n') return self.client.DeleteNickname(nickname=nickname) - print 'Nickname deleted' + print('Nickname deleted') def Run(self): """Runs the sample by getting user input and taking appropriate action.""" @@ -267,14 +267,14 @@ ] self._AuthorizeClient() while True: - print '\nChoose an option:\n0 - to exit' + print('\nChoose an option:\n0 - to exit') for i in range (0, len(functions_list)): - print '%d - %s' % ((i+1), functions_list[i]['description']) - choice = int(raw_input()) + print('%d - %s' % ((i+1), functions_list[i]['description'])) + choice = int(input()) if choice == 0: break if choice < 0 or choice > 11: - print 'Not a valid option!' + print('Not a valid option!') continue functions_list[choice-1]['function']() @@ -290,8 +290,8 @@ opts, args = getopt.getopt(sys.argv[1:], '', ['client_id=', 'client_secret=', RefactoringTool: Refactored ./samples/apps/user_profile_contacts_2lo.py RefactoringTool: Refactored ./samples/apps/suspended_users_cleanup.py 'domain=']) - except getopt.error, msg: - print 'Usage: %s' % usage + except getopt.error as msg: + print('Usage: %s' % usage) return client_id = None @@ -307,13 +307,13 @@ domain = arg if None in (client_id, client_secret, domain): - print 'Usage: %s' % usage + print('Usage: %s' % usage) return try: user_provisioning = UserProvisioning(client_id, client_secret, domain) except gdata.service.BadAuthentication: - print 'Invalid user credentials given.' + print('Invalid user credentials given.') return user_provisioning.Run() --- ./samples/apps/user_profile_contacts_2lo.py (original) +++ ./samples/apps/user_profile_contacts_2lo.py (refactored) @@ -67,21 +67,21 @@ """ for email in profile.email: if email.primary == 'true': - print 'Email: %s (primary)' % email.address + print('Email: %s (primary)' % email.address) else: - print 'Email: %s' % email.address + print('Email: %s' % email.address) if profile.name: - print 'Name: %s' % profile.name.full_name.text + print('Name: %s' % profile.name.full_name.text) if profile.nickname: - print 'Nickname: %s' % profile.nickname.text + print('Nickname: %s' % profile.nickname.text) if profile.occupation: - print 'Occupation: %s' % profile.occupation.text + print('Occupation: %s' % profile.occupation.text) if profile.gender: - print 'Gender: %s' % profile.gender.value + print('Gender: %s' % profile.gender.value) if profile.birthday: - print 'Birthday: %s' % profile.birthday.when + print('Birthday: %s' % profile.birthday.when) for phone_number in profile.phone_number: - print 'Phone Number: %s' % phone_number.text + print('Phone Number: %s' % phone_number.text) def GetProfile(self, admin_id, user_id): """Retrieves the profile of a user. @@ -116,8 +116,8 @@ contact_feed = self.contacts_client.GetContacts() for contact_entry in contact_feed.entry: contacts.append(contact_entry.title.text) - except gdata.client.Unauthorized, e: - print 'Error: %s %s' % (e.status, e.reason) + except gdata.client.Unauthorized as e: + print('Error: %s %s' % (e.status, e.reason)) return contacts def Run(self, admin_id, user_id): @@ -128,16 +128,16 @@ user_id: String, user whose information is retrieved. """ self.TwoLOAuthorize(admin_id) - print 'Profile of user: %s' % user_id + print('Profile of user: %s' % user_id) profile = self.GetProfile(admin_id, user_id) self.PrintProfile(profile) user = self.apps_client.RetrieveUser(user_id) - print 'Is admin: %s' % user.login.admin - print 'Suspended: %s' % user.login.suspended + print('Is admin: %s' % user.login.admin) + print('Suspended: %s' % user.login.suspended) contacts = self.GetContacts(user_id) - print '\nContacts of user ' + print('\nContacts of user ') for contact in contacts: - print contact + print(contact) def main(): --- ./samples/apps/suspended_users_cleanup.py (original) +++ ./samples/apps/suspended_users_cleanup.py (refactored) @@ -62,7 +62,7 @@ (opts, args) = getopt.getopt(sys.argv[1:], '', ['email=', 'password=', 'domain=']) except getopt.GetoptError: - print 'Error' + print('Error') Usage() sys.exit(1) opts = dict(opts) @@ -100,15 +100,15 @@ days = duration.days if days > 180: account_id = account_fields[2] - print 'This user is obsolete: %s' % account_id + print('This user is obsolete: %s' % account_id) user_name = account_id.split('@') - delete_flag = raw_input('Do you want to delete the user (y/n)? ') + delete_flag = input('Do you want to delete the user (y/n)? ') if delete_flag == 'y': try: client.DeleteUser(user_name[0]) - print 'Deleted %s ' % account_id - except gdata.client.RequestError,RefactoringTool: Refactored ./samples/apps/search_organize_users.py RefactoringTool: Refactored ./samples/apps/provisioning_oauth_example/main.py RefactoringTool: Refactored ./samples/apps/provisioning_oauth2_example.py e: - print 'Request Error %s %s %s' % (e.status, e.reason, e.body) + print('Deleted %s ' % account_id) + except gdata.client.RequestError as e: + print('Request Error %s %s %s' % (e.status, e.reason, e.body)) if __name__ == '__main__': --- ./samples/apps/search_organize_users.py (original) +++ ./samples/apps/search_organize_users.py (refactored) @@ -58,10 +58,10 @@ client_id=self.client_id, client_secret=self.client_secret, scope=SCOPES, user_agent=USER_AGENT) uri = self.token.generate_authorize_url() - print 'Please visit this URL to authorize the application:' - print uri + print('Please visit this URL to authorize the application:') + print(uri) # Get the verification code from the standard input. - code = raw_input('What is the verification code? ').strip() + code = input('What is the verification code? ').strip() self.token.get_access_token(code) self.user_client = AppsClient(domain=self.domain, auth_token=self.token) self.org_client = OrganizationUnitProvisioningClient( @@ -86,18 +86,18 @@ matched_users.append(user_email) # Maximum BATCH_SIZE users can be moved at one time # Split users into batches of BATCH_SIZE and move in batches - for i in xrange(0, len(matched_users), BATCH_SIZE): + for i in range(0, len(matched_users), BATCH_SIZE): batch_to_move = matched_users[i: i + BATCH_SIZE] self.org_client.MoveUserToOrgUnit(customer_id, org_unit_path, batch_to_move) - print 'Number of users moved = %d' % len(matched_users) + print('Number of users moved = %d' % len(matched_users)) def Run(self, org_unit_path, regex): self.AuthorizeClient() customer_id_entry = self.org_client.RetrieveCustomerId() customer_id = customer_id_entry.customer_id pattern = re.compile(regex) - print 'Moving Users with the pattern %s' % regex + print('Moving Users with the pattern %s' % regex) self.OrganizeUsers(customer_id, org_unit_path, pattern) --- ./samples/apps/provisioning_oauth_example/main.py (original) +++ ./samples/apps/provisioning_oauth_example/main.py (refactored) @@ -74,7 +74,7 @@ else: self.redirect('/login') return - except AppsForYourDomainException, e: + except AppsForYourDomainException as e: # Usually a Forbidden (403) when signed-in user isn't the admin. self.response.out.write(e.args[0].get('body')) else: --- ./samples/apps/provisioning_oauth2_example.py (original) +++ ./samples/apps/provisioning_oauth2_example.py (refactored) @@ -50,13 +50,13 @@ scope=SCOPE, user_agent='oauth2-provisioningv2') self.uri = self.token.generate_authorize_url() - print 'Please visit this URL to authorize the application:' - print self.uri + print('Please visit this URL to authorize the application:') + print(self.uri) # Get the verification code from the standard input. - code = raw_input('What is the verification code? ').strip() + code = input('What is the verification code? ').strip() self.token.get_access_token(code) - except gdata.gauth.OAuth2AccessTokenError, e: - print 'Invalid Access token, Check your credentials %s' % e + except gdata.gauth.OAuth2AccessTokenError as e: + print('Invalid Access token, Check your credentials %s' % e) exit(0) self.domain = domain self.baseuri = '%s/%s' % (BASE_URL, domain) @@ -79,14 +79,14 @@ for entry in feed.entry: user_name, domain = entry.member_id.split('@', 1) if entry.member_type == 'User' and domain == self.domain: - print 'creating filter for %s' % entry.member_id + print('creating filter for %s' % entry.member_id) self.email_client.CreateFilter(user_name, does_not_have_the_word=self.domain, mark_as_read=True) elif entry.member_type == 'User': - RefactoringTool: Refactored ./samples/apps/orgunit_quick_start_example.py print 'User belongs to other Domain %s' %entry.member_id + print('User belongs to other Domain %s' %entry.member_id) else: - print 'Member is a group %s' %entry.member_id + print('Member is a group %s' %entry.member_id) def run(self, group): feed = self.client.RetrieveAllMembers(group) --- ./samples/apps/orgunit_quick_start_example.py (original) +++ ./samples/apps/orgunit_quick_start_example.py (refactored) @@ -63,10 +63,10 @@ client_id=self.client_id, client_secret=self.client_secret, scope=SCOPE, user_agent=USER_AGENT) uri = self.token.generate_authorize_url() - print 'Please visit this URL to authorize the application:' - print uri + print('Please visit this URL to authorize the application:') + print(uri) # Get the verification code from the standard input. - code = raw_input('What is the verification code? ').strip() + code = input('What is the verification code? ').strip() self.token.get_access_token(code) self.client = OrganizationUnitProvisioningClient( domain=self.domain, auth_token=self.token) @@ -77,12 +77,12 @@ Args: entry: [gdata.apps.organization.data.CustomerIdEntry] """ - print '\nCustomer Id: %s' % (entry.customer_id) - print 'Org unit name: %s' % (entry.org_unit_name) - print 'Customer org unit name: %s' % (entry.customer_org_unit_name) - print 'Org unit description: %s' % (entry.org_unit_description) - print 'Customer org unit description: %s' % ( - entry.customer_org_unit_description) + print('\nCustomer Id: %s' % (entry.customer_id)) + print('Org unit name: %s' % (entry.org_unit_name)) + print('Customer org unit name: %s' % (entry.customer_org_unit_name)) + print('Org unit description: %s' % (entry.org_unit_description)) + print('Customer org unit description: %s' % ( + entry.customer_org_unit_description)) def _PrintOrgUnitDetails(self, entry): """Prints the attributes for a OrgUnitEntry. @@ -91,13 +91,13 @@ entry: [gdata.apps.organization.data.OrgUnitEntry] """ if entry: - print '\nOrg unit name: %s' % (entry.org_unit_name) - print 'Org unit path: %s' % (entry.org_unit_path) - print 'Parent org unit path: %s' % (entry.parent_org_unit_path) - print 'organization unit description: %s' % (entry.org_unit_description) - print 'Block inheritance flag: %s' % (entry.org_unit_block_inheritance) + print('\nOrg unit name: %s' % (entry.org_unit_name)) + print('Org unit path: %s' % (entry.org_unit_path)) + print('Parent org unit path: %s' % (entry.parent_org_unit_path)) + print('organization unit description: %s' % (entry.org_unit_description)) + print('Block inheritance flag: %s' % (entry.org_unit_block_inheritance)) else: - print 'null entry' + print('null entry') def _PrintOrgUserDetails(self, entry): """Prints the attributes for a OrgUserEntry. @@ -106,10 +106,10 @@ entry: [gdata.apps.organization.data.OrgUserEntry] """ if entry: - print 'Org user email: %s' % (entry.user_email) - print 'Org unit path: %s' % (entry.org_unit_path) + print('Org user email: %s' % (entry.user_email)) + print('Org unit path: %s' % (entry.org_unit_path)) else: - print 'null entry' + print('null entry') def _GetChoice(self, for_field): """Gets input for boolean fields. @@ -120,7 +120,7 @@ Returns: boolean input for the given field """ - choice = raw_input(('(Optional) Enter a choice for %s\n' + choice = input(('(Optional) Enter a choice for %s\n' '1-True 2-False ') % (for_field)) if choice == '1': return True @@ -133,9 +133,9 @@ string org_unit_path entered by the user """ - org_unit_path = raw_input('Enter the org unit path ') - if org_unit_path is None: - print 'Organization path missing\n' + org_unit_path = input('Enter the org unit path ') + if org_unit_path is None: + print('Organization path missing\n') return return org_unit_path @@ -156,10 +156,10 @@ Args: customer_id : string customer_id of organization """ - name = raw_input('Enter a name for organization: ') - parent_org_unit_path = raw_input('(default "/")' + name = input('Enter a name for organization: ') + parent_org_unit_path = input('(default "/")' 'Enter full path of the parentental tree: ') - description = raw_input('(Optional) Enter description of organization: ') + description = input('(Optional) Enter description of organization: ') block_inheritance = self._GetChoice('(default: False) block_inheritance: ') if not parent_org_unit_path: parent_org_unit_path = '/' @@ -169,9 +169,9 @@ parent_org_unit_path=parent_org_unit_path, description=description, block_inheritance=block_inheritance) self._PrintOrgUnitDetails(orgunit_entry) - print 'Org unit Created' - except gdata.client.RequestError, e: - print e.reason, e.body + print('Org unit Created') + except gdata.client.RequestError as e: + print(e.reason, e.body) return def _UpdateOrgUnit(self, customer_id): @@ -186,13 +186,13 @@ try: org_unit_entry = self.client.RetrieveOrgUnit(customer_id=customer_id, org_unit_path=org_unit_path) - print self._PrintOrgUnitDetails(org_unit_entry) + print(self._PrintOrgUnitDetails(org_unit_entry)) attributes = {1: 'org_name', 2: 'parent_org_unit_path', 3: 'description', 4: 'block_inheritance'} - print attributes + print(attributes) while True: - attr = int(raw_input('\nEnter number(1-4) of attribute to be updated')) - updated_val = raw_input('Enter updated value ') + attr = int(input('\nEnter number(1-4) of attribute to be updated')) + updated_val = input('Enter updated value ') if attr == 1: org_unit_entry.org_unit_name = updated_val if attr == 2: @@ -201,14 +201,14 @@ org_unit_entry.org_unit_description = updated_val if attr == 4: org_unit_entry.login.org_unit_block_inheritance = updated_val - choice = raw_input('\nDo you want to update more attributes y/n') + choice = input('\nDo you want to update more attributes y/n') if choice != 'y': break self.client.UpdateOrgUnit(customer_id=customer_id, org_unit_path=org_unit_path, org_unit_entry=org_unit_entry) - print 'Updated Org unit' - except gdata.client.RequestError, e: - print e.reason, e.body + print('Updated Org unit') + except gdata.client.RequestError as e: + print(e.reason, e.body) return def _RetrieveOrgUnit(self, customer_id): @@ -224,8 +224,8 @@ response = self.client.RetrieveOrgUnit(customer_id=customer_id, org_unit_path=org_unit_path) self._PrintOrgUnitDetails(response) - except gdata.client.RequestError, e: - print e.reason, e.body + except gdata.client.RequestError as e: + print(e.reason, e.body) return def _RetrieveAllOrgUnits(self, customer_id): @@ -238,8 +238,8 @@ response = self.client.RetrieveAllOrgUnits(customer_id=customer_id) for entry in response.entry: self._PrintOrgUnitDetails(entry) - except gdata.client.RequestError, e: - print e.reason, e.body + except gdata.client.RequestError as e: + print(e.reason, e.body) return def _RetrieveSubOrgUnits(self, customer_id): @@ -255,12 +255,12 @@ response = self.client.RetrieveSubOrgUnits(customer_id=customer_id, org_unit_path=org_unit_path) if not response.entry: - print 'No Sub organization units' + print('No Sub organization units') return for entry in response.entry: self._PrintOrgUnitDetails(entry) - except gdata.client.RequestError, e: - print e.reason, e.body + except gdata.client.RequestError as e: + print(e.reason, e.body) return def _MoveUsers(self, customer_id): @@ -274,21 +274,21 @@ return users = [] while True: - user = raw_input('Enter user email address ') + user = input('Enter user email address ') if user: users.append(user) else: break if users is None: - print 'No users given to move' + print('No users given to move') return try: self.client.MoveUserToOrgUnit(customer_id=customer_id, org_unit_path=org_unit_path, users_to_move=users) - print 'Moved users' - print users - except gdata.client.RequestError, e: - print e.reason, e.body + print('Moved users') + print(users) + except gdata.client.RequestError as e: + print(e.reason, e.body) return def _DeleteOrgUnit(self, customer_id): @@ -303,9 +303,9 @@ try: self.client.DeleteOrgUnit(customer_id=customer_id, org_unit_path=org_unit_path) - print 'OrgUnit Deleted' - except gdata.client.RequestError, e: - print e.reason, e.body + print('OrgUnit Deleted') + except gdata.client.RequestError as e: + print(e.reason, e.body) return def _UpdateOrgUser(self, customer_id): @@ -315,17 +315,17 @@ customer_id : string customer_id of organization """ org_unit_path = self._GetOrgUnitPath() - user_email = raw_input('Enter the email address') + user_email = input('Enter the email address') if None in (org_unit_path, user_email): - print 'Organization path and email are both required\n' + print('Organization path and email are both required\n') return try: org_user_entry = self.client.UpdateOrgUser(customer_id=customer_id, user_email=user_email, org_unit_path=org_unit_path) - print 'Updated org unit for user' - print self._PrintOrgUserDetails(org_user_entry) - except gdata.client.RequestError, e: - print e.reason, e.body + print('Updated org unit for user') + print(self._PrintOrgUserDetails(org_user_entry)) + except gdata.client.RequestError as e: + print(e.reason, e.body) return def _RetrieveOrgUser(self, customer_id): @@ -334,16 +334,16 @@ Args: customer_id : string customer_id of organization """ - user_email = raw_input('Enter the email address ') + user_email = input('Enter the email address ') if user_email is None: - print 'Email address missing\n' + print('Email address missing\n') return try: response = self.client.RetrieveOrgUser(customer_id=customer_id, user_email=user_email) self._PrintOrgUserDetails(response) - except gdata.client.RequestError, e: - print e.reason, e.body + except gdata.client.RequestError as e: + print(e.reason, e.body) return def _RetrieveOrgUnitUsers(self, customer_id): @@ -359,12 +359,12 @@ response = self.client.RetrieveOrgUnitUsers(customer_id=customer_id, org_unit_path=org_unit_path) if not response.entry: - print 'No users in this organization' + print('No users in this organization') return for entry in response.entry: self._PrintOrgUserDetails(entry) - except gdata.client.RequestError, e: - print e.reason, e.body + except gdata.client.RequestError as e: + print(e.reason, e.body) return def _RetrieveAllOrgUsers(self, customer_id): @@ -377,8 +377,8 @@ response = self.client.RetrieveAllOrgUsers(customer_id=customer_id) for entry in response.entry: self._PrintOrgUserDetails(entry) - except gdata.client.RequestError, e: - print e.reason, e.body + except gdata.client.RequestError as e: + print(e.reason, e.body) return def Run(self): @@ -416,14 +416,14 @@ 'description': 'Retrieve all org users'} ] while True: - print '\nChoose an option:\n0 - to exit' + print('\nChoose an option:\n0 - to exit') for i in range (0, len(functions_list)): - print '%d - %s' % ((i+1), functions_list[i]['description']) - choice = int(rawRefactoringTool: Refactored ./samples/apps/org_unit_sites.py RefactoringTool: Refactored ./samples/apps/multidomain_quick_start_example.py _input()) + print('%d - %s' % ((i+1), functions_list[i]['description'])) + choice = int(input()) if choice == 0: break if choice < 0 or choice > 11: - print 'Not a valid option!' + print('Not a valid option!') continue functions_list[choice-1]['function'](customer_id=customer_id) @@ -440,7 +440,7 @@ 'client_secret=', 'domain=']) except getopt.error: - print 'Usage: %s' % usage + print('Usage: %s' % usage) return client_id = None @@ -456,14 +456,14 @@ domain = arg if None in (client_id, client_secret, domain): - print 'Usage: %s' % usage + print('Usage: %s' % usage) return try: orgunit_provisioning = OrgUnitProvisioning( client_id, client_secret, domain) except gdata.service.BadAuthentication: - print 'Invalid user credentials given.' + print('Invalid user credentials given.') return orgunit_provisioning.Run() --- ./samples/apps/org_unit_sites.py (original) +++ ./samples/apps/org_unit_sites.py (refactored) @@ -142,8 +142,8 @@ try: site_entry = self.sites_client.CreateSite(site_title, description=description, theme=theme) - except gdata.client.RequestError, error: - print error + except gdata.client.RequestError as error: + print(error) self.sites_client.site = site_name return site_entry @@ -308,14 +308,14 @@ def Run(self): """Controls the entire flow of the sites making process""" - print 'Starting the process. This may take few minutes.' - print 'Creating user pages...' + print('Starting the process. This may take few minutes.') + print('Creating user pages...') self._CreateUserPages() - print 'User pages created' - print 'Creating Organization Unit Pages' + print('User pages created') + print('Creating Organization Unit Pages') self._CreateOrgUnitPages() - print 'Your website is ready, visit it at: %s' % (self._GetSiteURI( - ORG_SITE_TITLE)) + print('Your website is ready, visit it at: %s' % (self._GetSiteURI( + ORG_SITE_TITLE))) def main(): @@ -323,7 +323,7 @@ # Parse command line options try: opts, args = getopt.getopt(sys.argv[1:], '', ['email=', 'pw=', 'domain=']) - except getopt.error, msg: + except getopt.error as msg: print ('python org_unit_sites.py --email [emailaddress] --pw [password]' ' --domain [domain]') sys.exit(2) @@ -341,23 +341,23 @@ domain = arg while not email: - email = raw_input('Please enter admin email address (admin@example.com): ') + email = input('Please enter admin email address (admin@example.com): ') while not password: sys.stdout.write('Admin Password: ') password = getpass.getpass() if not password: - print 'Password cannot be blank.' + print('Password cannot be blank.') while not domain: username, domain = email.split('@', 1) - choice = raw_input('You have not given us the domain name. ' + + choice = input('You have not given us the domain name. ' + 'Is it %s? (y/n)' % (domain)) if choice == 'n': - domain = raw_input('Please enter domain name (domain.com): ') + domain = input('Please enter domain name (domain.com): ') try: org_unit_address_book = OrgUnitAddressBook(email, password, domain) except gdata.service.BadAuthentication: - print 'Invalid user credentials given.' + print('Invalid user credentials given.') return org_unit_address_book.Run() --- ./samples/apps/multidomain_quick_start_example.py (original) +++ ./samples/apps/multidomain_quick_start_example.py (refactored) @@ -63,10 +63,10 @@ client_id=self.client_id, client_secret=self.client_secret, scope=SCOPE, user_agent=USER_AGENT) uri = token.generate_authorize_url() - print 'Please visit this URL to authorize the application:' - print uri + print('Please visit this URL to authorize the application:') + print(uri) # Get the verification code from the standard input. - code = raw_input('What is the verification code? ').strip() + code = input('What is the verification code? ').strip() token.get_access_token(code) self.multidomain_client = ( gdata.apps.multidomain.client.MultiDomainProvisioningClient( @@ -79,14 +79,14 @@ entry: [UserEntry] User entry corresponding to a user """ - print 'First Name: %s' % (entry.first_name) - print 'Last Name: %s' % (entry.last_name) - print 'Email: %s' % (entry.email) - print 'Is Admin: %s' % (entry.is_admin) - print 'Is Suspended: %s' % (entry.suspended) - print 'Change password at next login: %s' % ( - entry.change_password_at_next_login) - print '\n' + print('First Name: %s' % (entry.first_name)) + print('Last Name: %s' % (entry.last_name)) + print('Email: %s' % (entry.email)) + print('Is Admin: %s' % (entry.is_admin)) + print('Is Suspended: %s' % (entry.suspended)) + print('Change password at next login: %s' % ( + entry.change_password_at_next_login)) + print('\n') def _PrintAliasDetails(self, entry): """Prints all the information for a user alias entry. @@ -95,9 +95,9 @@ entry: [AliasEntry] Alias entry correspoding to an alias """ - print 'User Email: %s' % (entry.user_email) - print 'Alias Email: %s' % (entry.alias_email) - print '\n' + print('User Email: %s' % (entry.user_email)) + print('Alias Email: %s' % (entry.alias_email)) + print('\n') def _GetChoice(self, for_field): """Gets a choice for a field. @@ -108,7 +108,7 @@ Return: True/False/None: Depending on the choice made by the user. """ - choice = int(raw_input(('Enter a choice for %s\n' + choice = int(input(('Enter a choice for %s\n' '1-True 2-False 3-Default/Skip: ') % (for_field))) if choice == 1: return True @@ -131,15 +131,15 @@ extra_stmt = '. Press enter to not update the field' user_data = UserData() while not user_data.email: - user_data.email = raw_input('Enter a valid email address' + user_data.email = input('Enter a valid email address' '(username@domain.com): ') while not user_data.first_name: - user_data.first_name = raw_input(('Enter first name for the user%s: ') + user_data.first_name = input(('Enter first name for the user%s: ') % (extra_stmt)) if function == 'update': break while not user_data.last_name: - user_data.last_name = raw_input(('Enter last name for the user%s: ') + user_data.last_name = input(('Enter last name for the user%s: ') % (extra_stmt)) if function == 'update': break @@ -152,7 +152,7 @@ if function == 'update' and user_data.password.__len__() == 0: break if user_data.password.__len__() < 8: - print 'Password must be at least 8 characters long' + print('Password must be at least 8 characters long') user_data.password = '' if function == 'update' and user_data.password.__len__() == 0: break @@ -160,11 +160,11 @@ user_data.confirm_password = getpass.getpass() user_data.is_admin = self._GetChoice('is_admin') - user_data.hash_function = raw_input('Enter a hash function or None: ') + user_data.hash_function = input('Enter a hash function or None: ') user_data.suspended = self._GetChoice('suspended') user_data.change_password = self._GetChoice('change_password') user_data.ip_whitelisted = self._GetChoice('ip_whitelisted') - user_data.quota = raw_input('Enter a quota or None: ') + user_data.quota = input('Enter a quota or None: ') if user_data.quota == 'None' or not user_data.quota.isdigit(): user_data.quota = None @@ -215,9 +215,9 @@ old_email = '' new_email = '' while not old_email: - old_email = raw_input('Enter old email address(username@domain.com): ') + old_email = input('Enter old email address(username@domain.com): ') while not new_email: - new_email = raw_input('Enter new email address(username@domain.com): ') + new_email = input('Enter new email address(username@domain.com): ') self.multidomain_client.RenameUser(old_email, new_email) @@ -226,7 +226,7 @@ email = '' while not email: - email = raw_input('Enter a valid email address(username@domain.com): ') + email = input('Enter a valid email address(username@domain.com): ') response = self.multidomain_client.RetrieveUser(email) self._PrintUserDetails(response) @@ -243,7 +243,7 @@ email = '' while not email: - email = raw_input('Enter a valid email address(username@domain.com): ') + email = input('Enter a valid email address(username@domain.com): ') self.multidomain_client.DeleteUser(email) @@ -253,9 +253,9 @@ email = '' alias = '' while not email: - email = raw_input('Enter a valid email address(username@domain.com): ') + email = input('Enter a valid email address(username@domain.com): ') while not alias: - alias = raw_input('Enter a valid alias email address' + alias = input('Enter a valid alias email address' '(username@domain.com): ') self.multidomain_client.CreateAlias(email, alias) @@ -264,7 +264,7 @@ alias = '' while not alias: - alias = raw_input('Enter a valid alias email address' + alias = input('Enter a valid alias email address' '(username@domain.com): ') response = self.multidomain_client.RetrieveAlias(alias) self._PrintAliasDetails(response) @@ -281,7 +281,7 @@ email = '' while not email: - email = raw_input('Enter a valid email address(username@domain.com): ') + email = input('Enter a valid email address(username@domain.com): ') response = self.multidomain_client.RetrieveAllUserAliases(email) for entry in response.entry: self._PrintAliasDetails(entry) @@ -291,7 +291,7 @@ alias = '' while not alias: - alias = raw_input('Enter a valid alias email address' + alias = input('Enter a valid alias email address' '(username@domain.com): ') self.multidomain_client.DeleteAlias(alias) @@ -325,14 +325,14 @@ ] while True: - print 'Choose an option:\n0 - to exit' + print('Choose an option:\n0 - to exit') for i in range (0, len(functions_list)): - print '%d - %s' % ((i+1), functions_list[i]['description']) - choice = int(raw_input()) + print('%d - %s' % ((i+1), functions_list[i]['description'])) + choice = int(input()) if choice == 0: break if choice < 0 or choice > len(functions_list): - print 'Not a valid option!' + print('Not a valid option!') continue functions_list[choice-1]['function']() @@ -345,7 +345,7 @@ opts, args = getopt.getopt(sys.argv[1:], '', ['client_id=', 'client_secret=', 'domain=']) - except getopt.error, msg: + except getopt.error as msg: print ('python multidomain_provisioning_quick_start_example.py' '--client_id [clientId] --client_secret [clientSecret]' '--domain [domain]') @@ -364,17 +364,17 @@ domain = arg while not client_id: - client_id = raw_input('Please enter a clientId: ') + client_id = input('Please enter a clientId: ') while not client_secret: - client_secret = raw_input('Please enter a clientSecret: ') + client_secret = input('Please enter a clientSecret: ') while not domain: - domain = raw_input('Please enter domain name (example.com): ') + domain = input('Please enter domain name (example.com): ') try: multidomRefactoringTool: Refactored ./samples/apps/migration_example.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/gdata/urlfetch.py ain_quick_start_example = MultiDomainQuickStartExample( client_id, client_secret, domain) except gdata.service.BadAuthentication: - print 'Invalid user credentials given.' + print('Invalid user credentials given.') return multidomain_quick_start_example.Run() --- ./samples/apps/migration_example.py (original) +++ ./samples/apps/migration_example.py (refactored) @@ -59,7 +59,7 @@ """ if os.path.isfile(path): if os.path.splitext(path)[1] != '.txt': - print "The input file is not a .txt file" + print("The input file is not a .txt file") return self._MigrateOneMail(path) elif os.path.isdir(path): @@ -73,7 +73,7 @@ if os.path.isfile(filepath) and os.path.splitext(filepath)[1] == '.txt': txt_file_paths.append(filepath) if not txt_file_paths: - print "Found no .txt file in the directory" + print("Found no .txt file in the directory") return elif len(txt_file_paths) == 1: # Don't use threading if there's only one txt file in the dir @@ -87,13 +87,13 @@ Args: path: The path of the message file """ - print "Attempting to migrate 1 message..." + print("Attempting to migrate 1 message...") content = self._ReadFileAsString(path) self.service.ImportMail(user_name=options.username, mail_message=content, mail_item_properties=self.mail_item_properties, mail_labels=self.mail_labels) - print "Successfully migrated 1 message." + print("Successfully migrated 1 message.") def _MigrateManyMails(self, paths): """Imports several messages via the ImportMultipleMails service. @@ -101,7 +101,7 @@ Args: paths: List of paths of message files """ - print "Attempting to migrate %d messages..." % (len(paths)) + print("Attempting to migrate %d messages..." % (len(paths))) for path in paths: content = self._ReadFileAsString(path) self.service.AddMailEntry(mail_message=content, @@ -109,7 +109,7 @@ mail_labels=self.mail_labels, identifier=path) success = self.service.ImportMultipleMails(user_name=options.username) - print "Successfully migrated %d of %d messages." % (success, len(paths)) + print("Successfully migrated %d of %d messages." % (success, len(paths))) def _ReadFileAsString(self, path): """Reads the file found at path into a string @@ -130,7 +130,7 @@ file_str.append(eachline) input_file.close() return ''.join(file_str) - except IOError, e: + except IOError as e: raise IOError(e.args[1] + ': ' + path) @@ -167,7 +167,7 @@ options.file = options.file.strip() if not os.path.exists(options.file): - print "Invalid file or directory path" + print("Invalid file or directory path") return sample = EmailMigrationSample(domain=options.domain, --- ./samples/apps/marketplace_sample/gdata/urlfetch.py (original) +++ ./samples/apps/marketplace_sample/gdata/urlfetch.py (refactored) @@ -38,7 +38,7 @@ __author__ = 'api.jscudder (Jeff Scudder)' -import StringIO +import io import atom.service import atom.http_interface from google.appengine.api import urlfetch @@ -188,7 +188,7 @@ if isinstance(service.additional_headers, dict): headers = service.additional_headers.copy() if isinstance(extra_headers, dict): - for header, value in extra_headers.iteritems(): + for header, value in extra_headers.items(): headers[header] = value # Add the content type header (we don't need to calculate content length, # since urlfetch.Fetch will calculate for us). @@ -229,7 +229,7 @@ """ def __init__(self, urlfetch_response): - self.body = StringIO.StringIO(urlfetch_response.content) + self.body = io.StringIO(urlfetch_response.content) self.headers = urlfetch_response.headers self.status = urlfetch_response.status_code self.reason = '' @@ -241,7 +241,7 @@RefactoringTool: No changes to ./samples/apps/marketplace_sample/gdata/test_data.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/gdata/test_config.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/gdata/service.py return self.body.read(length) def getheader(self, name): - if not self.headers.has_key(name): + if name not in self.headers: return self.headers[name.lower()] return self.headers[name] --- ./samples/apps/marketplace_sample/gdata/test_config.py (original) +++ ./samples/apps/marketplace_sample/gdata/test_config.py (refactored) @@ -63,7 +63,7 @@ def get(self): value = self.default # Check for a command line parameter. - for i in xrange(len(sys.argv)): + for i in range(len(sys.argv)): if sys.argv[i].startswith('--%s=' % self.name): value = sys.argv[i].split('=')[1] elif sys.argv[i] == '--%s' % self.name: @@ -77,8 +77,8 @@ if self.secret: value = getpass.getpass(prompt) else: - print 'You can specify this on the command line using --%s' % self.name - value = raw_input(prompt) + print('You can specify this on the command line using --%s' % self.name) + value = input(prompt) return value @@ -107,7 +107,7 @@ def render_usage(self): message_parts = [] - for opt_name, option in self.options.iteritems(): + for opt_name, option in self.options.items(): message_parts.append('--%s: %s' % (opt_name, option.description)) return '\n'.join(message_parts) @@ -395,7 +395,7 @@ def check_data_classes(test, classes): import inspect for data_class in classes: - test.assert_(data_class.__doc__ is not None, + test.assertTrue(data_class.__doc__ is not None, 'The class %s should have a docstring' % data_class) if hasattr(data_class, '_qname'): qname_versions = None @@ -404,13 +404,13 @@ else: qname_versions = (data_class._qname,) for versioned_qname in qname_versions: - test.assert_(isinstance(versioned_qname, str), + test.assertTrue(isinstance(versioned_qname, str), 'The class %s has a non-string _qname' % data_class) - test.assert_(not versioned_qname.endswith('}'), + test.assertTrue(not versioned_qname.endswith('}'), 'The _qname for class %s is only a namespace' % ( data_class)) - for attribute_name, value in data_class.__dict__.iteritems(): + for attribute_name, value in data_class.__dict__.items(): # Ignore all elements that start with _ (private members) if not attribute_name.startswith('_'): try: @@ -433,9 +433,9 @@ def check_clients_with_auth(test, classes): for client_class in classes: - test.assert_(hasattr(client_class, 'api_version')) - test.assert_(isinstance(client_class.auth_service, (str, unicode, int))) - test.assert_(hasattr(client_class, 'auth_service')) - test.assert_(isinstance(client_class.auth_service, (str, unicode))) - test.assert_(hasattr(client_class, 'auth_scopes')) - test.assert_(isinstance(client_class.auth_scopes, (list, tuple))) + test.assertTrue(hasattr(client_class, 'api_version')) + test.assertTrue(isinstance(client_class.auth_service, (str, int))) + test.assertTrue(hasattr(client_class, 'auth_service')) + test.assertTrue(isinstance(client_class.auth_service, str)) + test.assertTrue(hasattr(client_class, 'auth_scopes')) + test.assertTrue(isinstance(client_class.auth_scopes, (list, tuple))) --- ./samples/apps/marketplace_sample/gdata/service.py (original) +++ ./samples/apps/marketplace_sample/gdata/service.py (refactored) @@ -61,8 +61,8 @@ __author__ = 'api.jscudder (Jeffrey Scudder)' import re -import urllib -import urlparse +import urllib.request, urllib.parse, urllib.error +import urllib.parse try: from xml.etree import cElementTree as ElementTree except ImportError: @@ -786,22 +786,22 @@ if captcha_parameters: self.__captcha_token = captcha_parameters['token'] self.__captcha_url = captcha_parameters['url'] - raise CaptchaRequired, 'Captcha Required' + raise CaptchaRequired('Captcha Required') elif response_body.splitlines()[0] == 'Error=BadAuthentication': self.__captcha_token = None self.__captcha_url = None - raise BadAuthentication, 'Incorrect username or password' + raise BadAuthentication('Incorrect username or password') else: self.__captcha_token = None self.__captcha_url = None - raise Error, 'Server responded with a 403 code' + raise Error('Server responded with a 403 code') elif auth_response.status == 302: self.__captcha_token = None self.__captcha_url = None # Google tries to redirect all bad URLs back to # http://www.google.. If a redirect # attempt is made, assume the user has supplied an incorrect authentication URL - raise BadAuthenticationServiceURL, 'Server responded with a 302 code.' + raise BadAuthenticationServiceURL('Server responded with a 302 code.') def ClientLogin(self, username, password, account_type=None, service=None, auth_service_url=None, source=None, captcha_token=None, @@ -946,8 +946,8 @@ if response.status == 200: return result_body else: - raise RequestError, {'status': response.status, - 'body': result_body} + raise RequestError({'status': response.status, + 'body': result_body}) def GetWithRetries(self, uri, extra_headers=None, redirects_remaining=4, encoding='UTF-8', converter=None, num_retries=DEFAULT_NUM_RETRIES, @@ -997,13 +997,13 @@ except SystemExit: # Allow this error raise - except RequestError, e: + except RequestError as e: # Error 500 is 'internal server error' and warrants a retry # Error 503 is 'service unavailable' and warrants a retry if e[0]['status'] not in [500, 503]: raise e # Else, fall through to the retry code... - except Exception, e: + except Exception as e: if logger: logger.debug(e) # Fall through to the retry code... @@ -1096,16 +1096,16 @@ return GDataService.Get(self, location, extra_headers, redirects_remaining - 1, encoding=encoding, converter=converter) else: - raise RequestError, {'status': server_response.status, + raise RequestError({'status': server_response.status, 'reason': '302 received without Location header', - 'body': result_body} + 'body': result_body}) else: - raise RequestError, {'status': server_response.status, + raise RequestError({'status': server_response.status, 'reason': 'Redirect received, but redirects_remaining <= 0', - 'body': result_body} - else: - raise RequestError, {'status': server_response.status, - 'reason': server_response.reason, 'body': result_body} + 'body': result_body}) + else: + raise RequestError({'status': server_response.status, + 'reason': server_response.reason, 'body': result_body}) def GetMedia(self, uri, extra_headers=None): """Returns a MediaSource containing media and its metadata from the given @@ -1140,7 +1140,7 @@ if isinstance(result, atom.Entry): return result else: - raise UnexpectedReturnType, 'Server did not send an entry' + raise UnexpectedReturnType('Server did not send an entry') def GetFeed(self, uri, extra_headers=None, converter=gdata.GDataFeedFromString): @@ -1165,7 +1165,7 @@ if isinstance(result, atom.Feed): return result else: - raise UnexpectedReturnType, 'Server did not send a feed' + raise UnexpectedReturnType('Server did not send a feed') def GetNext(self, feed): """Requests the next 'page' of results in the feed. @@ -1346,16 +1346,16 @@ extra_headers, url_params, escape_params, redirects_remaining - 1, media_source, converter=converter) else: - raise RequestError, {'status': server_response.status, + raise RequestError({'status': server_response.status, 'reason': '302 received without Location header', - 'body': result_body} + 'body': result_body}) else: - raise RequestError, {'status': server_response.status, + raise RequestError({'status': server_response.status, 'reason': 'Redirect received, but redirects_remaining <= 0', - 'body': result_body} - else: - raise RequestError, {'status': server_response.status, - 'reason': server_response.reason, 'body': result_body} + 'body': result_body}) + else: + raise RequestError({'status': server_response.status, + 'reason': server_response.reason, 'body': result_body}) def Put(self, data, uri, extra_headers=None, url_params=None, escape_params=True, redirects_remaining=3, media_source=None, @@ -1443,16 +1443,16 @@ return GDataService.Delete(self, location, extra_headers, url_params, escape_params, redirects_remaining - 1) else: - raise RequestError, {'status': server_response.status, + raise RequestError({'status': server_response.status, 'reason': '302 received without Location header', - 'body': result_body} + 'body': result_body}) else: - raise RequestError, {'status': server_response.status, + raise RequestError({'status': server_response.status, 'reason': 'Redirect received, but redirects_remaining <= 0', - 'body': result_body} - else: - raise RequestError, {'status': server_response.status, - 'reason': server_response.reason, 'body': result_body} + 'body': result_body}) + else: + raise RequestError({'status': server_response.status, + 'reason': server_response.reason, 'body': result_body}) def ExtractToken(url, scopes_included_in_next=True): @@ -1475,13 +1475,13 @@ this token should be valid. If the scope was not included in the URL, the tuple will contain (token, None). """ - parsed = urlparse.urlparse(url) + parsed = urllib.parse.urlparse(url) token = gdata.auth.AuthSubTokenFromUrl(parsed[4]) scopes = '' if scopes_included_in_next: for pair in parsed[4].split('&'): if pair.startswith('%s=' % SCOPE_URL_PARAM_NAME): - scopes = urllib.unquote_plus(pair.split('=')[1]) + scopes = urllib.parse.unquote_plus(pair.split('=')[1]) return (token, scopes.split(' ')) @@ -1528,9 +1528,9 @@ scope = scopes if include_scopes_in_next: if next.find('?') > -1: - next += '&%s' % urllib.urlencode({SCOPE_URL_PARAM_NAME:scope}) - else: - next += '?%s' % urllib.urlencode({SCOPE_URL_PARAM_NAME:scope}) + next += '&%s' % urllib.parse.urlencode({SCOPE_URL_PARAM_NAME:scope}) + else: + next += '?%s' % urllib.parse.urlencode({SCOPE_URL_PARAM_NAME:scope}) return gdata.auth.GenerateAuthSubUrl(next=next, scope=scope, secure=secure, session=session, request_url=request_url, domain=hd) @@ -1582,7 +1582,7 @@ self.categories.append(category) def _GetTextQuery(self): - if 'q' in self.keys(): + if 'q' in list(self.keys()): return self['q'] else: return None @@ -1594,7 +1594,7 @@ doc="""The feed query's q parameter""") def _GetAuthor(self): - if 'author' in self.keys(): + if 'author' in list(self.keys()): return self['author'] else: return None @@ -1606,7 +1606,7 @@ doc="""The feed query's author parameter""") def _GetAlt(self): - if 'alt' in self.keys(): + if 'alt' in list(self.keys()): return self['alt'] else: return None @@ -1618,7 +1618,7 @@ doc="""The feed query's alt parameter""") def _GetUpdatedMin(self): - if 'updated-min' in self.keys(): + if 'updated-min' in list(self.keys()): return self['updated-min'] else: return None @@ -1630,7 +1630,7 @@ doc="""The feed query's updated-min parameter""") def _GetUpdatedMax(self): - if 'updated-max' in self.keys(): + if 'updated-max' in listRefactoringTool: Refactored ./samples/apps/marketplace_sample/gdata/sample_util.py (self.keys()): return self['updated-max'] else: return None @@ -1642,7 +1642,7 @@ doc="""The feed query's updated-max parameter""") def _GetPublishedMin(self): - if 'published-min' in self.keys(): + if 'published-min' in list(self.keys()): return self['published-min'] else: return None @@ -1654,7 +1654,7 @@ doc="""The feed query's published-min parameter""") def _GetPublishedMax(self): - if 'published-max' in self.keys(): + if 'published-max' in list(self.keys()): return self['published-max'] else: return None @@ -1666,7 +1666,7 @@ doc="""The feed query's published-max parameter""") def _GetStartIndex(self): - if 'start-index' in self.keys(): + if 'start-index' in list(self.keys()): return self['start-index'] else: return None @@ -1680,7 +1680,7 @@ doc="""The feed query's start-index parameter""") def _GetMaxResults(self): - if 'max-results' in self.keys(): + if 'max-results' in list(self.keys()): return self['max-results'] else: return None @@ -1694,7 +1694,7 @@ doc="""The feed query's max-results parameter""") def _GetOrderBy(self): - if 'orderby' in self.keys(): + if 'orderby' in list(self.keys()): return self['orderby'] else: return None @@ -1708,7 +1708,7 @@ def ToUri(self): q_feed = self.feed or '' category_string = '/'.join( - [urllib.quote_plus(c) for c in self.categories]) + [urllib.parse.quote_plus(c) for c in self.categories]) # Add categories to the feed if there are any. if len(self.categories) > 0: q_feed = q_feed + '/-/' + category_string --- ./samples/apps/marketplace_sample/gdata/sample_util.py (original) +++ ./samples/apps/marketplace_sample/gdata/sample_util.py (refactored) @@ -21,7 +21,7 @@ import sys import getpass -import urllib +import urllib.request, urllib.parse, urllib.error import gdata.gauth __author__ = 'j.s@google.com (Jeff Scudder)' @@ -52,7 +52,7 @@ return self.prefs[name] # Second, check for a command line parameter. value = None - for i in xrange(len(sys.argv)): + for i in range(len(sys.argv)): if sys.argv[i].startswith('--%s=' % name): value = sys.argv[i].split('=')[1] elif sys.argv[i] == '--%s' % name: @@ -64,7 +64,7 @@ if secret: value = getpass.getpass(prompt) else: - value = raw_input(prompt) + value = input(prompt) # If we want to save the preference for reuse in future requests, add it # to this object's prefs. if value is not None and reuse: @@ -94,7 +94,7 @@ 'between each URL.\n' 'Example: http://www.google.com/calendar/feeds/,' 'http://www.google.com/m8/feeds/\n', reuse=True).split(',') - elif isinstance(scopes, (str, unicode)): + elif isinstance(scopes, str): scopes = scopes.split(',') if auth_type == CLIENT_LOGIN: @@ -129,7 +129,7 @@ private_key = private_key_file.read() private_key_file.close() except IOError: - print 'Unable to read private key from file' + print('Unable to read private key from file') if private_key is not None: if client.auth_token is None: @@ -149,7 +149,7 @@ auth_url = gdata.gauth.generate_auth_sub_url( 'http://gauthmachine.appspot.com/authsub', scopes, True) - print 'with a private key, get ready for this URL', auth_url + print('with a private key, get ready for this URL', auth_url) else: if client.auth_token is None: @@ -170,12 +170,12 @@ auth_url = gdata.gauth.generate_auth_sub_url( 'http://gauthmachine.appspot.com/authsub', scopes) - print 'Visit the following URL in your browser to authorize this app:' - print str(auth_url) - print 'After agreeing to authorize the app, copy the token value from' - print ' the URL. Example: "www.google.com/?token=ab12" token value is' - RefactoringTool: No changes to ./samples/apps/marketplace_sample/gdata/oauth/rsa.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/gdata/oauth/__init__.py print ' ab12' - token_value = raw_input('Please enter the token value: ') + print('Visit the following URL in your browser to authorize this app:') + print(str(auth_url)) + print('After agreeing to authorize the app, copy the token value from') + print(' the URL. Example: "www.google.com/?token=ab12" token value is') + print(' ab12') + token_value = input('Please enter the token value: ') if private_key is not None: single_use_token = gdata.gauth.SecureAuthSubToken( token_value, private_key, scopes) @@ -219,26 +219,26 @@ private_key = private_key_file.read() private_key_file.close() except IOError: - print 'Unable to read private key from file' + print('Unable to read private key from file') request_token = client.get_oauth_token( scopes, 'http://gauthmachine.appspot.com/oauth', consumer_key, rsa_private_key=private_key) else: - print 'Invalid OAuth signature type' + print('Invalid OAuth signature type') return None # Authorize the request token in the browser. - print 'Visit the following URL in your browser to authorize this app:' - print str(request_token.generate_authorization_url()) - print 'After agreeing to authorize the app, copy URL from the browser\'s' - print ' address bar.' - url = raw_input('Please enter the url: ') + print('Visit the following URL in your browser to authorize this app:') + print(str(request_token.generate_authorization_url())) + print('After agreeing to authorize the app, copy URL from the browser\'s') + print(' address bar.') + url = input('Please enter the url: ') gdata.gauth.authorize_request_token(request_token, url) # Exchange for an access token. client.auth_token = client.get_access_token(request_token) else: - print 'Invalid authorization type.' + print('Invalid authorization type.') return None if client.auth_token: self.prefs['client_auth_token'] = gdata.gauth.token_to_blob( @@ -265,5 +265,5 @@ def print_options(): """Displays usage information, available command line params.""" # TODO: fill in the usage description for authorizing the client. - print '' - + print('') + --- ./samples/apps/marketplace_sample/gdata/oauth/__init__.py (original) +++ ./samples/apps/marketplace_sample/gdata/oauth/__init__.py (refactored) @@ -1,8 +1,8 @@ import cgi -import urllib +import urllib.request, urllib.parse, urllib.error import time import random -import urlparse +import urllib.parse import hmac import binascii @@ -22,7 +22,7 @@ # url escape def escape(s): # escape '/' too - return urllib.quote(s, safe='~') + return urllib.parse.quote(s, safe='~') # util function: current timestamp # seconds since epoch (UTC) @@ -60,7 +60,7 @@ self.secret = secret def to_string(self): - return urllib.urlencode({'oauth_token': self.key, 'oauth_token_secret': self.secret}) + return urllib.parse.urlencode({'oauth_token': self.key, 'oauth_token_secret': self.secret}) # return a token from something like: # oauth_token_secret=digg&oauth_token=digg @@ -112,7 +112,7 @@ # get any non-oauth parameters def get_nonoauth_parameters(self): parameters = {} - for k, v in self.parameters.iteritems(): + for k, v in self.parameters.items(): # ignore oauth parameters if k.find('oauth_') < 0: parameters[k] = v @@ -123,14 +123,14 @@ auth_header = 'OAuth realm="%s"' % realm # add the oauth parameters if self.parameters: - for k, v in self.parameters.iteritems(): + for k, v in self.parameters.items(): if k[:6] == 'oauth_': auth_header += ', %s="%s"' % (k, escape(str(v))) return {'Authorization': auth_header} # serialize as post data for a POST request def to_postdata(self): - returRefactoringTool: Refactored ./samples/apps/marketplace_sample/gdata/gauth.py n '&'.join(['%s=%s' % (escape(str(k)), escape(str(v))) for k, v in self.parameters.iteritems()]) + return '&'.join(['%s=%s' % (escape(str(k)), escape(str(v))) for k, v in self.parameters.items()]) # serialize as a url for a GET request def to_url(self): @@ -144,7 +144,7 @@ del params['oauth_signature'] except: pass - key_values = params.items() + key_values = list(params.items()) # sort lexicographically, first after key, then after value key_values.sort() # combine key value pairs in string and escape @@ -156,7 +156,7 @@ # parses the url and rebuilds it to be scheme://host/path def get_normalized_http_url(self): - parts = urlparse.urlparse(self.http_url) + parts = urllib.parse.urlparse(self.http_url) host = parts[1].lower() if host.endswith(':80') or host.endswith(':443'): host = host.split(':')[0] @@ -197,7 +197,7 @@ parameters.update(query_params) # URL parameters - param_str = urlparse.urlparse(http_url)[4] # query + param_str = urllib.parse.urlparse(http_url)[4] # query url_params = OAuthRequest._split_url_string(param_str) parameters.update(url_params) @@ -252,7 +252,7 @@ # split key-value param_parts = param.split('=', 1) # remove quotes and unescape the value - params[param_parts[0]] = urllib.unquote(param_parts[1].strip('\"')) + params[param_parts[0]] = urllib.parse.unquote(param_parts[1].strip('\"')) return params _split_header = staticmethod(_split_header) @@ -260,8 +260,8 @@ # even empty values should be included def _split_url_string(param_str): parameters = cgi.parse_qs(param_str, keep_blank_values=True) - for k, v in parameters.iteritems(): - parameters[k] = urllib.unquote(v[0]) + for k, v in parameters.items(): + parameters[k] = urllib.parse.unquote(v[0]) return parameters _split_url_string = staticmethod(_split_url_string) @@ -355,7 +355,7 @@ # get the signature method object signature_method = self.signature_methods[signature_method] except: - signature_method_names = ', '.join(self.signature_methods.keys()) + signature_method_names = ', '.join(list(self.signature_methods.keys())) raise OAuthError('Signature method %s not supported try one of the following: %s' % (signature_method, signature_method_names)) return signature_method --- ./samples/apps/marketplace_sample/gdata/gauth.py (original) +++ ./samples/apps/marketplace_sample/gdata/gauth.py (refactored) @@ -49,8 +49,8 @@ import datetime import time import random -import urllib -import urlparse +import urllib.request, urllib.parse, urllib.error +import urllib.parse import atom.http_core try: @@ -64,7 +64,7 @@ import json as simplejson try: - from urlparse import parse_qsl + from urllib.parse import parse_qsl except ImportError: from cgi import parse_qsl @@ -180,7 +180,7 @@ # user is responding to a captch challenge. request_fields['logintoken'] = captcha_token request_fields['logincaptcha'] = captcha_response - return urllib.urlencode(request_fields) + return urllib.parse.urlencode(request_fields) GenerateClientLoginRequestBody = generate_client_login_request_body @@ -265,7 +265,7 @@ # AuthSub functions and classes. def _to_uri(str_or_uri): - if isinstance(str_or_uri, (str, unicode)): + if isinstance(str_or_uri, str): return atom.http_core.Uri.parse_uri(str_or_uri) return str_or_uri @@ -314,16 +314,16 @@ An atom.http_core.Uri which the user's browser should be directed to in order to authorize this application to access their information. """ - if isinstance(next, (str, unicode)): + if isinstance(next, str): next = atom.http_core.Uri.parse_uri(next) # If the user passed in a string instead of a list for scopes, convert to # a single item tuple. - if isinstance(scopes, (str, unicode, atom.http_core.Uri)): + if isinstance(scopes, (str, atom.http_core.Uri)): scopes = (scopes,) scopes_string = ' '.join([str(scope) for scope in scopes]) next.query[scopes_param_prefix] = scopes_string - if isinstance(request_url, (str, unicode)): + if isinstance(request_url, str): request_url = atom.http_core.Uri.parse_uri(request_url) request_url.query['next'] = str(next) request_url.query['scope'] = scopes_string @@ -364,7 +364,7 @@ None. If there was no token param in the url, the tuple returned is (None, None) """ - if isinstance(url, (str, unicode)): + if isinstance(url, str): url = atom.http_core.Uri.parse_uri(url) if 'token' not in url.query: return (None, None) @@ -515,7 +515,7 @@ not be valid. """ timestamp = str(int(time.time())) - nonce = ''.join([str(random.randint(0, 9)) for i in xrange(15)]) + nonce = ''.join([str(random.randint(0, 9)) for i in range(15)]) data = build_auth_sub_data(http_request, timestamp, nonce) signature = generate_signature(data, self.rsa_private_key) http_request.headers['Authorization'] = ( @@ -579,14 +579,14 @@ sorted_keys = sorted(params.keys()) # The sorted function is not available in Python2.3 and lower except NameError: - sorted_keys = params.keys() + sorted_keys = list(params.keys()) sorted_keys.sort() pairs = [] for key in sorted_keys: - pairs.append('%s=%s' % (urllib.quote(key, safe='~'), - urllib.quote(params[key], safe='~'))) + pairs.append('%s=%s' % (urllib.parse.quote(key, safe='~'), + urllib.parse.quote(params[key], safe='~'))) # We want to escape /'s too, so use safe='~' - all_parameters = urllib.quote('&'.join(pairs), safe='~') + all_parameters = urllib.parse.quote('&'.join(pairs), safe='~') normailzed_host = http_request.uri.host.lower() normalized_scheme = (http_request.uri.scheme or 'http').lower() non_default_port = None @@ -601,12 +601,12 @@ if non_default_port is not None: # Set the only safe char in url encoding to ~ since we want to escape / # as well. - request_path = urllib.quote('%s://%s:%s%s' % ( + request_path = urllib.parse.quote('%s://%s:%s%s' % ( normalized_scheme, normailzed_host, non_default_port, path), safe='~') else: # Set the only safe char in url encoding to ~ since we want to escape / # as well. - request_path = urllib.quote('%s://%s%s' % ( + request_path = urllib.parse.quote('%s://%s%s' % ( normalized_scheme, normailzed_host, path), safe='~') # TODO: ensure that token escaping logic is correct, not sure if the token # value should be double escaped instead of single. @@ -627,10 +627,10 @@ hash_key = None hashed = None if token_secret is not None: - hash_key = '%s&%s' % (urllib.quote(consumer_secret, safe='~'), - urllib.quote(token_secret, safe='~')) + hash_key = '%s&%s' % (urllib.parse.quote(consumer_secret, safe='~'), + urllib.parse.quote(token_secret, safe='~')) else: - hash_key = '%s&' % urllib.quote(consumer_secret, safe='~') + hash_key = '%s&' % urllib.parse.quote(consumer_secret, safe='~') try: import hashlib hashed = hmac.new(hash_key, base_string, hashlib.sha1) @@ -698,7 +698,7 @@ params['oauth_verifier'] = verifier pairs = [ '%s="%s"' % ( - k, urllib.quote(v, safe='~')) for k, v in params.iteritems()] + k, urllib.parse.quote(v, safe='~')) for k, v in params.items()] return 'OAuth %s' % (', '.join(pairs)) @@ -741,7 +741,7 @@ request.uri.query['scope'] = ' '.join(scopes) timestamp = str(int(time.time())) - nonce = ''.join([str(random.randint(0, 9)) for i in xrange(15)]) + nonce = ''.join([str(random.randint(0, 9)) for i in range(15)]) signature = None if signature_type == HMAC_SHA1: signature = generate_hmac_signature( @@ -795,9 +795,9 @@ token_secret = None for pair in http_body.split('&'): if pair.startswith('oauth_token='): - token = urllib.unquote(pair[len('oauth_token='):]) + token = urllib.parse.unquote(pair[len('oauth_token='):]) if pair.startswith('oauth_token_secret='): - token_secret = urllib.unquote(pair[len('oauth_token_secret='):]) + token_secret = urllib.parse.unquote(pair[len('oauth_token_secret='):]) return (token, token_secret) @@ -866,14 +866,14 @@ A tuple of strings containing the OAuth token and the OAuth verifier which need to sent when upgrading a request token to an access token. """ - if isinstance(url, (str, unicode)): + if isinstance(url, str): url = atom.http_core.Uri.parse_uri(url) token = None verifier = None if 'oauth_token' in url.query: - token = urllib.unquote(url.query['oauth_token']) + token = urllib.parse.unquote(url.query['oauth_token']) if 'oauth_verifier' in url.query: - verifier = urllib.unquote(url.query['oauth_verifier']) + verifier = urllib.parse.unquote(url.query['oauth_verifier']) return (token, verifier) @@ -992,14 +992,14 @@ The same HTTP request object which was passed in. """ timestamp = str(int(time.time())) - nonce = ''.join([str(random.randint(0, 9)) for i in xrange(15)]) + nonce = ''.join([str(random.randint(0, 9)) for i in range(15)]) signature = generate_hmac_signature( http_request, self.consumer_key, self.consumer_secret, timestamp, - nonce, version='1.0', next=self.next, token=self.token, + nonce, version='1.0', next=self.__next__, token=self.token, token_secret=self.token_secret, verifier=self.verifier) http_request.headers['Authorization'] = generate_auth_header( self.consumer_key, timestamp, nonce, HMAC_SHA1, signature, - version='1.0', next=self.next, token=self.token, + version='1.0', next=self.__next__, token=self.token, verifier=self.verifier) return http_request @@ -1030,14 +1030,14 @@ The same HTTP request object which was passed in. """ timestamp = str(int(time.time())) - nonce = ''.join([str(random.randint(0, 9)) for i in xrange(15)]) + nonce = ''.join([str(random.randint(0, 9)) for i in range(15)]) signature = generate_rsa_signature( http_request, self.consumer_key, self.rsa_private_key, timestamp, - nonce, version='1.0', next=self.next, token=self.token, + nonce, version='1.0', next=self.__next__, token=self.token, token_secret=self.token_secret, verifier=self.verifier) http_request.headers['Authorization'] = generate_auth_header( self.consumer_key, timestamp, nonce, RSA_SHA1, signature, - version='1.0', next=self.next, token=self.token, + version='1.0', next=self.__next__, token=self.token, verifier=self.verifier) return http_request @@ -1155,7 +1155,7 @@ http: An instance of httplib2.Http.request or something that acts like it. """ - body = urllib.urlencode({ + body = urllib.parse.urlencode({ 'grant_type': 'refresh_token', 'client_id': self.client_id, 'client_secret': self.client_secret, @@ -1213,10 +1213,10 @@ 'scope': self.scope, } query.update(kwargs) - parts = list(urlparse.urlparse(self.auth_uri)) + parts = list(urllib.parse.urlparse(self.auth_uri)) query.update(dict(parse_qsl(parts[4]))) # 4 is the index of the query part - parts[4] = urllib.urlencode(query) - return urlparse.urlunparse(parts) + parts[4] = urllib.parse.urlencode(query) + return urllib.parse.urlunparse(parts) def get_access_token(self, code): """Exhanges a code for an access token. @@ -1227,10 +1227,10 @@ the code. """ - if not (isinstance(code, str) or isinstance(code, unicode)): + if not (isinstance(code, str) or isinstance(code, str)): code = code['code'] - body = urllib.urlencode({ + body = urllib.parse.urlencode({ 'grant_type': 'authorization_code', 'client_id': self.client_id, 'client_sRefactoringTool: No changes to ./samples/apps/marketplace_sample/gdata/data.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/gdata/core.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/gdata/client.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/gdata/calendar/service.py ecret': self.client_secret, @@ -1316,7 +1316,7 @@ Returns: A string in the form 1x|member1|member2|member3... """ - return '|'.join([urllib.quote_plus(a or '') for a in args]) + return '|'.join([urllib.parse.quote_plus(a or '') for a in args]) def _split_token_parts(blob): @@ -1334,7 +1334,7 @@ Returns: A list of unescaped strings. """ - return [urllib.unquote_plus(part) or None for part in blob.split('|')] + return [urllib.parse.unquote_plus(part) or None for part in blob.split('|')] def token_to_blob(token): @@ -1377,12 +1377,12 @@ elif isinstance(token, OAuthRsaToken): return _join_token_parts( '1r', token.consumer_key, token.rsa_private_key, token.token, - token.token_secret, str(token.auth_state), token.next, + token.token_secret, str(token.auth_state), token.__next__, token.verifier) elif isinstance(token, OAuthHmacToken): return _join_token_parts( '1h', token.consumer_key, token.consumer_secret, token.token, - token.token_secret, str(token.auth_state), token.next, + token.token_secret, str(token.auth_state), token.__next__, token.verifier) elif isinstance(token, OAuth2Token): return _join_token_parts( @@ -1471,7 +1471,7 @@ """ result_scopes = [] if service_names is None: - for service_name, scopes in AUTH_SCOPES.iteritems(): + for service_name, scopes in AUTH_SCOPES.items(): result_scopes.extend(scopes) else: for service_name in service_names: --- ./samples/apps/marketplace_sample/gdata/core.py (original) +++ ./samples/apps/marketplace_sample/gdata/core.py (refactored) @@ -51,7 +51,7 @@ # Recursively transform all members of the dict. # When converting a dict, we do not convert _name items into private # Jsonc members. - for key, value in x.iteritems(): + for key, value in x.items(): jsonc_obj._dict[key] = _convert_to_jsonc(value) return jsonc_obj elif isinstance(x, list): @@ -112,7 +112,7 @@ if isinstance(jsonc_obj, Jsonc): plain = {} - for key, value in jsonc_obj._dict.iteritems(): + for key, value in jsonc_obj._dict.items(): plain[key] = _convert_to_object(value) return plain elif isinstance(jsonc_obj, list): @@ -232,7 +232,7 @@ def __init__(self, _dict=None, **kwargs): json = _dict or {} - for key, value in kwargs.iteritems(): + for key, value in kwargs.items(): if key.startswith('_'): object.__setattr__(self, key, value) else: --- ./samples/apps/marketplace_sample/gdata/client.py (original) +++ ./samples/apps/marketplace_sample/gdata/client.py (refactored) @@ -240,7 +240,7 @@ body will be converted to the class using atom.core.parse. """ - if isinstance(uri, (str, unicode)): + if isinstance(uri, str): uri = atom.http_core.Uri.parse_uri(uri) # Add the gsession ID to the URL to prevent further redirects. @@ -742,7 +742,7 @@ # If the user passes in a URL, just delete directly, may not work as # the service might require an ETag. - if isinstance(entry_or_uri, (str, unicode, atom.http_core.Uri)): + if isinstance(entry_or_uri, (str, atom.http_core.Uri)): return self.request(method='DELETE', uri=entry_or_uri, http_request=http_request, auth_token=auth_token, **kwargs) @@ -1037,7 +1037,7 @@ http_request=http_request, desired_class=self.desired_class) return response - except RequestError, error: + except RequestError as error: if error.status == 308: return None else: @@ -1183,7 +1183,7 @@ else: raise error_from_response( '%s returned by server' % response.status, response, RequestError) - except RequestError, error: + except RequestError as error: if error.status == 308: for pair in error.headers: if pair[0].capitalize() == 'Range': --- ./samples/apps/marketplace_sample/gdatRefactoringTool: No changes to ./samples/apps/marketplace_sample/gdata/calendar/data.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/gdata/calendar/client.py a/calendar/service.py (original) +++ ./samples/apps/marketplace_sample/gdata/calendar/service.py (refactored) @@ -28,7 +28,7 @@ __author__ = 'api.vli (Vivian Li)' -import urllib +import urllib.request, urllib.parse, urllib.error import gdata import atom.service import gdata.service @@ -452,13 +452,13 @@ text_query=None, params=None, categories=None): gdata.service.Query.__init__(self, feed='http://www.google.com/calendar/feeds/%s/%s/%s' % ( - urllib.quote(user), - urllib.quote(visibility), - urllib.quote(projection)), + urllib.parse.quote(user), + urllib.parse.quote(visibility), + urllib.parse.quote(projection)), text_query=text_query, params=params, categories=categories) def _GetStartMin(self): - if 'start-min' in self.keys(): + if 'start-min' in list(self.keys()): return self['start-min'] else: return None @@ -470,7 +470,7 @@ doc="""The start-min query parameter""") def _GetStartMax(self): - if 'start-max' in self.keys(): + if 'start-max' in list(self.keys()): return self['start-max'] else: return None @@ -482,21 +482,21 @@ doc="""The start-max query parameter""") def _GetOrderBy(self): - if 'orderby' in self.keys(): + if 'orderby' in list(self.keys()): return self['orderby'] else: return None def _SetOrderBy(self, val): if val is not 'lastmodified' and val is not 'starttime': - raise Error, "Order By must be either 'lastmodified' or 'starttime'" + raise Error("Order By must be either 'lastmodified' or 'starttime'") self['orderby'] = val orderby = property(_GetOrderBy, _SetOrderBy, doc="""The orderby query parameter""") def _GetSortOrder(self): - if 'sortorder' in self.keys(): + if 'sortorder' in list(self.keys()): return self['sortorder'] else: return None @@ -505,15 +505,15 @@ if (val is not 'ascending' and val is not 'descending' and val is not 'a' and val is not 'd' and val is not 'ascend' and val is not 'descend'): - raise Error, "Sort order must be either ascending, ascend, " + ( - "a or descending, descend, or d") + raise Error("Sort order must be either ascending, ascend, " + ( + "a or descending, descend, or d")) self['sortorder'] = val sortorder = property(_GetSortOrder, _SetSortOrder, doc="""The sortorder query parameter""") def _GetSingleEvents(self): - if 'singleevents' in self.keys(): + if 'singleevents' in list(self.keys()): return self['singleevents'] else: return None @@ -525,7 +525,7 @@ doc="""The singleevents query parameter""") def _GetFutureEvents(self): - if 'futureevents' in self.keys(): + if 'futureevents' in list(self.keys()): return self['futureevents'] else: return None @@ -537,7 +537,7 @@ doc="""The futureevents query parameter""") def _GetRecurrenceExpansionStart(self): - if 'recurrence-expansion-start' in self.keys(): + if 'recurrence-expansion-start' in list(self.keys()): return self['recurrence-expansion-start'] else: return None @@ -550,7 +550,7 @@ doc="""The recurrence-expansion-start query parameter""") def _GetRecurrenceExpansionEnd(self): - if 'recurrence-expansion-end' in self.keys(): + if 'recurrence-expansion-end' in list(self.keys()): return self['recurrence-expansion-end'] else: return None @@ -566,7 +566,7 @@ self['ctz'] = val def _GetTimezone(self): - if 'ctz' in self.keys(): + if 'ctz' in list(self.keys()): return self['ctz'] else: return None --- ./samples/apps/marketplace_sample/gdata/calendar/client.py (original) +++ ./samples/apps/marketplace_sample/gdata/calendar/client.py (refactored) @@ -28,7 +28,7 @@ __author__ = 'alainv (Alain Vongsouvanh)' -import urllib +import urllib.request, urllib.parse, urllib.error import gdata.client impRefactoringTool: Refactored ./samples/apps/marketplace_sample/gdata/calendar/__init__.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/gdata/auth.py ort gdata.calendar.data import atom.data --- ./samples/apps/marketplace_sample/gdata/calendar/__init__.py (original) +++ ./samples/apps/marketplace_sample/gdata/calendar/__init__.py (refactored) @@ -337,7 +337,7 @@ self.extension_attributes = extension_attributes or {} def findKey(self, value): - res=[item[0] for item in self.enum_map.items() if item[1] == value] + res=[item[0] for item in list(self.enum_map.items()) if item[1] == value] if res is None or len(res) == 0: return None return res[0] @@ -348,7 +348,7 @@ self.value = self.enum_map[value] return # Find the attribute in this class's list of attributes. - if self.__class__._attributes.has_key(attribute): + if attribute in self.__class__._attributes: # Find the member of this class which corresponds to the XML attribute # (lookup in current_class._attributes) and set this member to the # desired value (using self.__dict__). @@ -364,7 +364,7 @@ # This uses the class's _children dictionary to find the members which # should become XML child nodes. member_node_names = [values[0] for tag, values in - self.__class__._children.iteritems()] + self.__class__._children.items()] for member_name in member_node_names: member = getattr(self, member_name) if member is None: @@ -379,7 +379,7 @@ if key is not None: tree.attrib[self.attrib_name]=key # Convert the members of this class which are XML attributes. - for xml_attribute, member_name in self.__class__._attributes.iteritems(): + for xml_attribute, member_name in self.__class__._attributes.items(): member = getattr(self, member_name) if member is not None: tree.attrib[xml_attribute] = member @@ -940,7 +940,7 @@ child_tree)) return # Find the element's tag in this class's list of child members - if self.__class__._children.has_key(child_tree.tag): + if child_tree.tag in self.__class__._children: member_name = self.__class__._children[child_tree.tag][0] member_class = self.__class__._children[child_tree.tag][1] # If the class member is supposed to contain a list, make sure the --- ./samples/apps/marketplace_sample/gdata/auth.py (original) +++ ./samples/apps/marketplace_sample/gdata/auth.py (refactored) @@ -21,7 +21,7 @@ import re import time import types -import urllib +import urllib.request, urllib.parse, urllib.error import atom.http_interface import atom.token_store import atom.url @@ -257,7 +257,7 @@ callback_url += '&' else: callback_url += '?' - callback_url += urllib.urlencode({scopes_param_prefix:scopes}) + callback_url += urllib.parse.urlencode({scopes_param_prefix:scopes}) oauth_token = oauth.OAuthToken(request_token.key, request_token.secret) oauth_request = oauth.OAuthRequest.from_token_and_callback( token=oauth_token, callback=callback_url, @@ -336,7 +336,7 @@ else: session = 0 - request_params = urllib.urlencode({'next': next, 'scope': scope, + request_params = urllib.parse.urlencode({'next': next, 'scope': scope, 'secure': secure, 'session': session, 'hd': domain}) if request_url.find('?') == -1: @@ -385,12 +385,12 @@ An atom.url.Url which the user's browser should be directed to in order to authorize this application to access their information. """ - if isinstance(next, (str, unicode)): + if isinstance(next, str): next = atom.url.parse_url(next) scopes_string = ' '.join([str(scope) for scope in scopes]) next.params[scopes_param_prefix] = scopes_string - if isinstance(request_url, (str, unicode)): + if isinstance(request_url, str): request_url = atom.url.parse_url(request_url) request_url.params['next'] = str(next) request_url.params['scope'] = scopes_string @@ -465,7 +465,7 @@ the AuthSubToken deRefactoringTool: No changes to ./samples/apps/marketplace_sample/gdata/apps_property.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/gdata/apps/service.py faults to being valid for no scopes. If there was no 'token' parameter in the URL, this function returns None. """ - if isinstance(url, (str, unicode)): + if isinstance(url, str): url = atom.url.parse_url(url) if 'token' not in url.params: return None @@ -551,7 +551,7 @@ the OAuthToken defaults to being valid for no scopes. If there was no 'oauth_token' parameter in the URL, this function returns None. """ - if isinstance(url, (str, unicode)): + if isinstance(url, str): url = atom.url.parse_url(url) if 'oauth_token' not in url.params: return None @@ -734,12 +734,12 @@ def valid_for_scope(self, url): """Tells the caller if the token authorizes access to the desired URL. """ - if isinstance(url, (str, unicode)): + if isinstance(url, str): url = atom.url.parse_url(url) for scope in self.scopes: if scope == atom.token_store.SCOPE_ALL: return True - if isinstance(scope, (str, unicode)): + if isinstance(scope, str): scope = atom.url.parse_url(scope) if scope == url: return True @@ -804,7 +804,7 @@ oauth_token_secret=[1]. If both are absent, it returns None. """ if self.key and self.secret: - return urllib.urlencode({'oauth_token': self.key, + return urllib.parse.urlencode({'oauth_token': self.key, 'oauth_token_secret': self.secret}) elif self.key: return 'oauth_token=%s' % self.key @@ -841,7 +841,7 @@ dict Header to be sent with every subsequent request after authentication. """ - if isinstance(http_url, types.StringTypes): + if isinstance(http_url, (str,)): http_url = atom.url.parse_url(http_url) header = None token = None @@ -868,12 +868,12 @@ return http_client.request(operation, url, data=data, headers=headers) def valid_for_scope(self, url): - if isinstance(url, (str, unicode)): + if isinstance(url, str): url = atom.url.parse_url(url) for scope in self.scopes: if scope == atom.token_store.SCOPE_ALL: return True - if isinstance(scope, (str, unicode)): + if isinstance(scope, str): scope = atom.url.parse_url(scope) if scope == url: return True --- ./samples/apps/marketplace_sample/gdata/apps/service.py (original) +++ ./samples/apps/marketplace_sample/gdata/apps/service.py (refactored) @@ -26,7 +26,7 @@ from xml.etree import ElementTree except ImportError: from elementtree import ElementTree -import urllib +import urllib.request, urllib.parse, urllib.error import gdata import atom.service import gdata.service @@ -128,7 +128,7 @@ try: return gdata.apps.EmailListFeedFromString(str(self.GetWithRetries( uri, num_retries=num_retries, delay=delay, backoff=backoff))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def GetGeneratorForAllEmailLists( @@ -157,7 +157,7 @@ self._baseURL(), API_VER, list_name) try: return self.Get(uri, converter=gdata.apps.EmailListEntryFromString) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def RetrieveEmailLists(self, recipient): @@ -167,7 +167,7 @@ self._baseURL(), API_VER, recipient) try: ret = gdata.apps.EmailListFeedFromString(str(self.Get(uri))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) # pagination @@ -181,7 +181,7 @@ self._baseURL(), API_VER, list_name, recipient) try: self.Delete(uri) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def RetrievePageOfRecipients(self, list_name, start_recipient=None, @@ -199,7 +199,7 @@ return gdata.apps.EmailListRecipientFeedFromString(str( self.GetWithRetries( uri, num_retries=num_retries, delay=delay, backoff=backoff))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def GetGeneratorForAllRecipients( @@ -233,7 +233,7 @@ try: return gdata.apps.EmailListRecipientEntryFromString( str(self.Post(recipient_entry, uri))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def DeleteEmailList(self, list_name): @@ -242,7 +242,7 @@ uri = "%s/emailList/%s/%s" % (self._baseURL(), API_VER, list_name) try: self.Delete(uri) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def CreateEmailList(self, list_name): @@ -254,7 +254,7 @@ try: return gdata.apps.EmailListEntryFromString( str(self.Post(email_list_entry, uri))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def DeleteNickname(self, nickname): @@ -263,7 +263,7 @@ uri = "%s/nickname/%s/%s" % (self._baseURL(), API_VER, nickname) try: self.Delete(uri) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def RetrievePageOfNicknames(self, start_nickname=None, @@ -278,7 +278,7 @@ try: return gdata.apps.NicknameFeedFromString(str(self.GetWithRetries( uri, num_retries=num_retries, delay=delay, backoff=backoff))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def GetGeneratorForAllNicknames( @@ -308,7 +308,7 @@ try: first_page = gdata.apps.NicknameFeedFromString(str(self.GetWithRetries( uri, num_retries=num_retries, delay=delay, backoff=backoff))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) return self.GetGeneratorFromLinkFinder( first_page, gdata.apps.NicknameFeedFromString, num_retries=num_retries, @@ -320,7 +320,7 @@ uri = "%s/nickname/%s?username=%s" % (self._baseURL(), API_VER, user_name) try: ret = gdata.apps.NicknameFeedFromString(str(self.Get(uri))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) # pagination @@ -340,7 +340,7 @@ uri = "%s/nickname/%s/%s" % (self._baseURL(), API_VER, nickname) try: return gdata.apps.NicknameEntryFromString(str(self.Get(uri))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def CreateNickname(self, user_name, nickname): @@ -354,7 +354,7 @@ try: return gdata.apps.NicknameEntryFromString( str(self.Post(nickname_entry, uri))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def DeleteUser(self, user_name): @@ -363,7 +363,7 @@ uri = "%s/user/%s/%s" % (self._baseURL(), API_VER, user_name) try: return self.Delete(uri) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def UpdateUser(self, user_name, user_entry): @@ -372,7 +372,7 @@ uri = "%s/user/%s/%s" % (self._baseURL(), API_VER, user_name) try: return gdata.apps.UserEntryFromString(str(self.Put(user_entry, uri))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def CreateUser(self, user_name, family_name, given_name, password, @@ -394,7 +394,7 @@ try: rRefactoringTool: No changes to ./samples/apps/marketplace_sample/gdata/apps/organization/service.py RefactoringTool: No changes to ./samples/apps/marketplace_sample/gdata/apps/organization/data.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/gdata/apps/organization/client.py RefactoringTool: No changes to ./samples/apps/marketplace_sample/gdata/apps/multidomain/data.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/gdata/apps/multidomain/client.py eturn gdata.apps.UserEntryFromString(str(self.Post(user_entry, uri))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def SuspendUser(self, user_name): @@ -424,7 +424,7 @@ uri = "%s/user/%s/%s" % (self._baseURL(), API_VER, user_name) try: return gdata.apps.UserEntryFromString(str(self.Get(uri))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def RetrievePageOfUsers(self, start_username=None, @@ -439,7 +439,7 @@ try: return gdata.apps.UserFeedFromString(str(self.GetWithRetries( uri, num_retries=num_retries, delay=delay, backoff=backoff))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def GetGeneratorForAllUsers(self, @@ -488,7 +488,7 @@ def _GetPropertyEntry(self, properties): property_entry = gdata.apps.PropertyEntry() property = [] - for name, value in properties.iteritems(): + for name, value in properties.items(): if name is not None and value is not None: property.append(gdata.apps.Property(name=name, value=value)) property_entry.property = property @@ -503,7 +503,7 @@ def _GetPropertyFeed(self, uri): try: return gdata.apps.PropertyFeedFromString(str(self.Get(uri))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise gdata.apps.service.AppsForYourDomainException(e.args[0]) def _GetPropertiesList(self, uri): @@ -520,7 +520,7 @@ try: return self._PropertyEntry2Dict(gdata.apps.PropertyEntryFromString( str(self.Get(uri)))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise gdata.apps.service.AppsForYourDomainException(e.args[0]) def _PostProperties(self, uri, properties): @@ -528,7 +528,7 @@ try: return self._PropertyEntry2Dict(gdata.apps.PropertyEntryFromString( str(self.Post(property_entry, uri)))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise gdata.apps.service.AppsForYourDomainException(e.args[0]) def _PutProperties(self, uri, properties): @@ -536,13 +536,13 @@ try: return self._PropertyEntry2Dict(gdata.apps.PropertyEntryFromString( str(self.Put(property_entry, uri)))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise gdata.apps.service.AppsForYourDomainException(e.args[0]) def _DeleteProperties(self, uri): try: self.Delete(uri) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise gdata.apps.service.AppsForYourDomainException(e.args[0]) --- ./samples/apps/marketplace_sample/gdata/apps/organization/client.py (original) +++ ./samples/apps/marketplace_sample/gdata/apps/organization/client.py (refactored) @@ -27,7 +27,7 @@ __author__ = 'Gunjan Sharma ' -import urllib +import urllib.request, urllib.parse, urllib.error import gdata.apps.organization.data import gdata.client @@ -99,7 +99,7 @@ if org_unit_path_or_user_email: uri += '/' + org_unit_path_or_user_email if params: - uri += '?' + urllib.urlencode(params) + uri += '?' + urllib.parse.urlencode(params) return uri MakeOrganizationUnitProvisioningUri = make_organization_unit_provisioning_uri --- ./samples/apps/marketplace_sample/gdata/apps/multidomain/client.py (original) +++ ./samples/apps/marketplace_sample/gdata/apps/multidomain/client.py (refactored) @@ -26,7 +26,7 @@ __author__ = 'Claudio Cherubino ' -import urllib +import urllib.request, urllib.parse, urllib.error import gdata.apps.multidomain.data import gdata.client @@ -97,7 +97,7 @@ if email: uri += '/' + email if params: - uri += '?' + urllib.urlencode(params) + RefactoringTool: Refactored ./samples/apps/marketplace_sample/gdata/apps/migration/service.py RefactoringTool: No changes to ./samples/apps/marketplace_sample/gdata/apps/migration/__init__.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/gdata/apps/groups/service.py uri += '?' + urllib.parse.urlencode(params) return uri MakeMultidomainProvisioningUri = make_multidomain_provisioning_uri --- ./samples/apps/marketplace_sample/gdata/apps/migration/service.py (original) +++ ./samples/apps/marketplace_sample/gdata/apps/migration/service.py (refactored) @@ -76,14 +76,12 @@ mail_entry.rfc822_msg = migration.Rfc822Msg(text=(base64.b64encode( mail_message))) mail_entry.rfc822_msg.encoding = 'base64' - mail_entry.mail_item_property = map( - lambda x: migration.MailItemProperty(value=x), mail_item_properties) - mail_entry.label = map(lambda x: migration.Label(label_name=x), - mail_labels) + mail_entry.mail_item_property = [migration.MailItemProperty(value=x) for x in mail_item_properties] + mail_entry.label = [migration.Label(label_name=x) for x in mail_labels] try: return migration.MailEntryFromString(str(self.Post(mail_entry, uri))) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: # Store the number of failed imports when importing several at a time self.exceptions += 1 raise gdata.apps.service.AppsForYourDomainException(e.args[0]) @@ -107,10 +105,8 @@ mail_entry.rfc822_msg = migration.Rfc822Msg(text=(base64.b64encode( mail_message))) mail_entry.rfc822_msg.encoding = 'base64' - mail_entry.mail_item_property = map( - lambda x: migration.MailItemProperty(value=x), mail_item_properties) - mail_entry.label = map(lambda x: migration.Label(label_name=x), - mail_labels) + mail_entry.mail_item_property = [migration.MailItemProperty(value=x) for x in mail_item_properties] + mail_entry.label = [migration.Label(label_name=x) for x in mail_labels] self.mail_batch.AddBatchEntry(mail_entry) @@ -136,7 +132,7 @@ try: self.result = self.Post(self.mail_batch, uri, converter=migration.BatchMailEventFeedFromString) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise gdata.apps.service.AppsForYourDomainException(e.args[0]) self.mail_batch = migration.BatchMailEventFeed() @@ -212,7 +208,7 @@ batch_min = batch_max self.mail_entries = [] - except Exception, e: + except Exception as e: raise Exception(e.args[0]) else: return num_entries - self.exceptions --- ./samples/apps/marketplace_sample/gdata/apps/groups/service.py (original) +++ ./samples/apps/marketplace_sample/gdata/apps/groups/service.py (refactored) @@ -22,7 +22,7 @@ __author__ = 'google-apps-apis@googlegroups.com' -import urllib +import urllib.request, urllib.parse, urllib.error import gdata.apps import gdata.apps.service import gdata.service @@ -59,16 +59,16 @@ return GROUP_ID_URL % (domain, group_id) elif member_id != '': if direct_only: - return GROUP_MEMBER_DIRECT_URL % (domain, urllib.quote_plus(member_id), + return GROUP_MEMBER_DIRECT_URL % (domain, urllib.parse.quote_plus(member_id), self._Bool2Str(direct_only)) else: - return GROUP_MEMBER_URL % (domain, urllib.quote_plus(member_id)) + return GROUP_MEMBER_URL % (domain, urllib.parse.quote_plus(member_id)) else: return BASE_URL % (domain) if service_type == 'member': if member_id != '' and is_existed: - return MEMBER_ID_URL % (domain, group_id, urllib.quote_plus(member_id)) + return MEMBER_ID_URL % (domain, group_id, urllib.parse.quote_plus(member_id)) elif suspended_users: return MEMBER_WITH_SUSPENDED_URL % (domain, group_id, self._Bool2Str(suspended_users)) @@ -77,7 +77,7 @@ if service_type == 'owner': if owner_email != '' and is_existed: - return OWNER_ID_URL % (domain, group_id, urllib.quote_plus(owner_email)) + return OWNER_ID_URL % (domain, group_id, urllib.parse.quote_plus(owner_eRefactoringTool: No changes to ./samples/apps/marketplace_sample/gdata/apps/groups/data.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/gdata/apps/groups/client.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/gdata/apps/emailsettings/service.py RefactoringTool: No changes to ./samples/apps/marketplace_sample/gdata/apps/emailsettings/data.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/gdata/apps/emailsettings/client.py RefactoringTool: No changes to ./samples/apps/marketplace_sample/gdata/apps/data.py RefactoringTool: No changes to ./samples/apps/marketplace_sample/gdata/apps/client.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/gdata/apps/audit/service.py mail)) elif suspended_users: return OWNER_WITH_SUSPENDED_URL % (domain, group_id, self._Bool2Str(suspended_users)) @@ -93,7 +93,7 @@ try: self._GetProperties(uri) return True - except gdata.apps.service.AppsForYourDomainException, e: + except gdata.apps.service.AppsForYourDomainException as e: if e.error_code == gdata.apps.service.ENTITY_DOES_NOT_EXIST: return False else: --- ./samples/apps/marketplace_sample/gdata/apps/groups/client.py (original) +++ ./samples/apps/marketplace_sample/gdata/apps/groups/client.py (refactored) @@ -25,7 +25,7 @@ __author__ = 'Shraddha gupta ' -import urllib +import urllib.request, urllib.parse, urllib.error import gdata.apps.groups.data import gdata.client @@ -95,7 +95,7 @@ if member_id: uri += '/' + member_id if params: - uri += '?' + urllib.urlencode(params) + uri += '?' + urllib.parse.urlencode(params) return uri MakeGroupProvisioningUri = make_group_provisioning_uri --- ./samples/apps/marketplace_sample/gdata/apps/emailsettings/service.py (original) +++ ./samples/apps/marketplace_sample/gdata/apps/emailsettings/service.py (refactored) @@ -235,7 +235,7 @@ return self._PutProperties(uri, properties) def UpdateGeneral(self, username, page_size=None, shortcuts=None, arrows=None, - snippets=None, unicode=None): + snippets=None, str=None): """Update general settings. Args: @@ -259,6 +259,6 @@ properties['arrows'] = gdata.apps.service._bool2str(arrows) if snippets != None: properties['snippets'] = gdata.apps.service._bool2str(snippets) - if unicode != None: - properties['unicode'] = gdata.apps.service._bool2str(unicode) - return self._PutProperties(uri, properties) + if str != None: + properties['unicode'] = gdata.apps.service._bool2str(str) + return self._PutProperties(uri, properties) --- ./samples/apps/marketplace_sample/gdata/apps/emailsettings/client.py (original) +++ ./samples/apps/marketplace_sample/gdata/apps/emailsettings/client.py (refactored) @@ -28,7 +28,7 @@ __author__ = 'Claudio Cherubino ' -import urllib +import urllib.request, urllib.parse, urllib.error import gdata.apps.emailsettings.data import gdata.client @@ -176,7 +176,7 @@ """ uri = self.MakeEmailSettingsUri(username=username, setting_id=SETTING_ID_LABEL) - uri = '/'.join([uri, urllib.quote_plus(label)]) + uri = '/'.join([uri, urllib.parse.quote_plus(label)]) return self.delete(uri, **kwargs) DeleteLabel = delete_label --- ./samples/apps/marketplace_sample/gdata/apps/audit/service.py (original) +++ ./samples/apps/marketplace_sample/gdata/apps/audit/service.py (refactored) @@ -131,7 +131,7 @@ uri = self._serviceUrl('mail/monitor', user=source_user+'/'+destination_user) try: return self._DeleteProperties(uri) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def createAccountInformationRequest(self, user): @@ -148,7 +148,7 @@ #XML Body is left empty try: return self._PostProperties(uri, properties) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def getAccountInformationRequestStatus(self, user, request_id): @@ -164,7 +164,7 @@ uri = self._serviceUrl('account', user=user+'/'+request_id) try: return self._GetProperties(uri) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def getAllAccountInformationRequestsStatus(self): @@ -195,7 +195,7 @@ uri = self._serviceUrl('account', user=user+'/'+request_id) try: return self._DeleteProperties(uri) - except gdata.service.RequestError, e: + except gdata.service.RequeRefactoringTool: No changes to ./samples/apps/marketplace_sample/gdata/apps/apps_property_entry.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/gdata/apps/adminsettings/service.py RefactoringTool: No changes to ./samples/apps/marketplace_sample/gdata/apps/__init__.py RefactoringTool: No changes to ./samples/apps/marketplace_sample/gdata/__init__.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/domain_mgmt_app.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/atom/url.py stError as e: raise AppsForYourDomainException(e.args[0]) def createMailboxExportRequest(self, user, begin_date=None, end_date=None, include_deleted=False, search_query=None, headers_only=False): @@ -242,7 +242,7 @@ uri = self._serviceUrl('mail/export', user=user+'/'+request_id) try: return self._GetProperties(uri) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def getAllMailboxExportRequestsStatus(self): @@ -273,5 +273,5 @@ uri = self._serviceUrl('mail/export', user=user+'/'+request_id) try: return self._DeleteProperties(uri) - except gdata.service.RequestError, e: - raise AppsForYourDomainException(e.args[0]) + except gdata.service.RequestError as e: + raise AppsForYourDomainException(e.args[0]) --- ./samples/apps/marketplace_sample/gdata/apps/adminsettings/service.py (original) +++ ./samples/apps/marketplace_sample/gdata/apps/adminsettings/service.py (refactored) @@ -48,7 +48,7 @@ uri = self._serviceUrl(location) try: return self._GetProperties(uri) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) def GetDefaultLanguage(self): @@ -232,9 +232,9 @@ Returns: binary image file""" - import urllib + import urllib.request, urllib.parse, urllib.error url = 'http://www.google.com/a/cpanel/'+self.domain+'/images/logo.gif' - response = urllib.urlopen(url) + response = urllib.request.urlopen(url) return response.read() def UpdateDomainLogo(self, logoImage): @@ -414,7 +414,7 @@ uri = self._serviceUrl('email/gateway') try: return self._GetProperties(uri) - except gdata.service.RequestError, e: + except gdata.service.RequestError as e: raise AppsForYourDomainException(e.args[0]) except TypeError: #if no outbound gateway is set, we get a TypeError, --- ./samples/apps/marketplace_sample/domain_mgmt_app.py (original) +++ ./samples/apps/marketplace_sample/domain_mgmt_app.py (refactored) @@ -24,8 +24,8 @@ import logging import os import re -import urllib -from urlparse import urlparse +import urllib.request, urllib.parse, urllib.error +from urllib.parse import urlparse from django.utils import simplejson as json from google.appengine.api import users from google.appengine.ext import webapp @@ -70,7 +70,7 @@ session['domain'] = domain else: self.redirect('/_ah/login_required?' + - urllib.urlencode((self.request.str_params))) + urllib.parse.urlencode((self.request.str_params))) path = os.path.join(os.path.dirname(__file__), 'templates/index.html') self.response.out.write(template.render(path, {})) --- ./samples/apps/marketplace_sample/atom/url.py (original) +++ ./samples/apps/marketplace_sample/atom/url.py (refactored) @@ -18,8 +18,8 @@ __author__ = 'api.jscudder (Jeff Scudder)' -import urlparse -import urllib +import urllib.parse +import urllib.request, urllib.parse, urllib.error DEFAULT_PROTOCOL = 'http' @@ -32,7 +32,7 @@ This method can accept partial URLs, but it will leave missing members of the Url unset. """ - parts = urlparse.urlparse(url_string) + parts = urllib.parse.urlparse(url_string) url = Url() if parts[0]: url.protocol = parts[0] @@ -49,10 +49,10 @@ for pair in param_pairs: pair_parts = pair.split('=') if len(pair_parts) > 1: - url.params[urllib.unquote_plus(pair_parts[0])] = ( - urllib.unquote_plus(pair_parts[1])) + url.params[urllib.parse.unquote_plus(pair_parts[0])] = ( + urllib.parse.unquote_plus(pair_parts[1])) elif len(pair_parts) == 1: - url.params[urllib.unquote_plus(pair_parts[0])] = None + url.params[urllib.parse.unquote_plus(pair_parts[0])] = None return url class Url(object): @@ -84,13 +84,13 @@ url_parts[2] = self.path if self.params: url_parts[4] = self.get_paRefactoringTool: Refactored ./samples/apps/marketplace_sample/atom/token_store.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/atom/service.py ram_string() - return urlparse.urlunparse(url_parts) + return urllib.parse.urlunparse(url_parts) def get_param_string(self): param_pairs = [] - for key, value in self.params.iteritems(): - param_pairs.append('='.join((urllib.quote_plus(key), - urllib.quote_plus(str(value))))) + for key, value in self.params.items(): + param_pairs.append('='.join((urllib.parse.quote_plus(key), + urllib.parse.quote_plus(str(value))))) return '&'.join(param_pairs) def get_request_uri(self): --- ./samples/apps/marketplace_sample/atom/token_store.py (original) +++ ./samples/apps/marketplace_sample/atom/token_store.py (refactored) @@ -78,7 +78,7 @@ """ if url is None: return None - if isinstance(url, (str, unicode)): + if isinstance(url, str): url = atom.url.parse_url(url) if url in self._tokens: token = self._tokens[url] @@ -86,7 +86,7 @@ return token else: del self._tokens[url] - for scope, token in self._tokens.iteritems(): + for scope, token in self._tokens.items(): if token.valid_for_scope(url): return token return atom.http_interface.GenericToken() @@ -105,7 +105,7 @@ """ token_found = False scopes_to_delete = [] - for scope, stored_token in self._tokens.iteritems(): + for scope, stored_token in self._tokens.items(): if stored_token == token: scopes_to_delete.append(scope) token_found = True --- ./samples/apps/marketplace_sample/atom/service.py (original) +++ ./samples/apps/marketplace_sample/atom/service.py (refactored) @@ -36,8 +36,8 @@ import atom.token_store import os -import httplib -import urllib +import http.client +import urllib.request, urllib.parse, urllib.error import re import base64 import socket @@ -151,7 +151,7 @@ #@atom.v1_deprecated('Please use atom.client.AtomPubClient for requests.') def request(self, operation, url, data=None, headers=None, url_params=None): - if isinstance(url, (str, unicode)): + if isinstance(url, str): if url.startswith('http:') and self.ssl: # Force all requests to be https if self.ssl is True. url = atom.url.parse_url('https:' + url[5:]) @@ -163,7 +163,7 @@ url = atom.url.parse_url(url) if url_params: - for name, value in url_params.iteritems(): + for name, value in url_params.items(): url.params[name] = value all_headers = self.additional_headers.copy() @@ -347,12 +347,12 @@ def valid_for_scope(self, url): """Tells the caller if the token authorizes access to the desired URL. """ - if isinstance(url, (str, unicode)): + if isinstance(url, str): url = atom.url.parse_url(url) for scope in self.scopes: if scope == atom.token_store.SCOPE_ALL: return True - if isinstance(scope, (str, unicode)): + if isinstance(scope, str): scope = atom.url.parse_url(scope) if scope == url: return True @@ -430,15 +430,15 @@ # Trivial setup for ssl socket. ssl = socket.ssl(p_sock, None, None) - fake_sock = httplib.FakeSocket(p_sock, ssl) + fake_sock = http.client.FakeSocket(p_sock, ssl) # Initalize httplib and replace with the proxy socket. - connection = httplib.HTTPConnection(server) + connection = http.client.HTTPConnection(server) connection.sock=fake_sock full_uri = partial_uri else: - connection = httplib.HTTPSConnection(server, port) + connection = http.client.HTTPSConnection(server, port) full_uri = partial_uri else: @@ -454,14 +454,14 @@ proxy_password = os.environ.get('proxy_password') if proxy_username: UseBasicAuth(service, proxy_username, proxy_password, True) - connection = httplib.HTTPConnection(p_server, p_port) + connection = http.client.HTTPConnection(p_server, p_port) if not full_uri.startswith("http://"): if full_uri.startswith("/"): full_uri = "http://%s%s" % (service.server, full_RefactoringTool: Refactored ./samples/apps/marketplace_sample/atom/mock_service.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/atom/mock_http_core.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/atom/mock_http.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/atom/http_interface.py uri) else: full_uri = "http://%s/%s" % (service.server, full_uri) else: - connection = httplib.HTTPConnection(server, port) + connection = http.client.HTTPConnection(server, port) full_uri = partial_uri return (connection, full_uri) @@ -544,11 +544,11 @@ """ # Choose which function to use when modifying the query and parameters. # Use quote_plus when escape_params is true. - transform_op = [str, urllib.quote_plus][bool(escape_params)] + transform_op = [str, urllib.parse.quote_plus][bool(escape_params)] # Create a list of tuples containing the escaped version of the # parameter-value pairs. parameter_tuples = [(transform_op(param), transform_op(value)) - for param, value in (url_parameters or {}).items()] + for param, value in list((url_parameters or {}).items())] # Turn parameter-value tuples into a list of strings in the form # 'PARAMETER=VALUE'. return ['='.join(x) for x in parameter_tuples] @@ -658,8 +658,8 @@ # If the list of headers does not include a Content-Length, attempt to # calculate it based on the data object. - if (data and not service.additional_headers.has_key('Content-Length') and - not extra_headers.has_key('Content-Length')): + if (data and 'Content-Length' not in service.additional_headers and + 'Content-Length' not in extra_headers): content_length = CalculateDataLength(data) if content_length: extra_headers['Content-Length'] = str(content_length) --- ./samples/apps/marketplace_sample/atom/mock_service.py (original) +++ ./samples/apps/marketplace_sample/atom/mock_service.py (refactored) @@ -168,7 +168,7 @@ def ConcealSecrets(self, conceal_func): """Conceal secret data in this request.""" - if self.extra_headers.has_key('Authorization'): + if 'Authorization' in self.extra_headers: self.extra_headers['Authorization'] = conceal_func( self.extra_headers['Authorization']) --- ./samples/apps/marketplace_sample/atom/mock_http_core.py (original) +++ ./samples/apps/marketplace_sample/atom/mock_http_core.py (refactored) @@ -21,7 +21,7 @@ __author__ = 'j.s@google.com (Jeff Scudder)' -import StringIO +import io import pickle import os.path import tempfile @@ -250,7 +250,7 @@ http_request.headers, http_request._body_parts) def _http_request(self, uri, method, headers=None, body_parts=None): - body = StringIO.StringIO() + body = io.StringIO() response = atom.http_core.HttpResponse(status=200, reason='OK', body=body) if headers is None: response._headers = {} @@ -258,7 +258,7 @@ # Copy headers from the request to the response but convert values to # strings. Server response headers always come in as strings, so an int # should be converted to a corresponding string when echoing. - for header, value in headers.iteritems(): + for header, value in headers.items(): response._headers[header] = str(value) response._headers['Echo-Host'] = '%s:%s' % (uri.host, str(uri.port)) response._headers['Echo-Uri'] = uri._get_relative_path() --- ./samples/apps/marketplace_sample/atom/mock_http.py (original) +++ ./samples/apps/marketplace_sample/atom/mock_http.py (refactored) @@ -35,7 +35,7 @@ """ def __init__(self, operation, url, data=None, headers=None): self.operation = operation - if isinstance(url, (str, unicode)): + if isinstance(url, str): url = atom.url.parse_url(url) self.url = url self.data = data @@ -112,7 +112,7 @@ If there is no match, a NoRecordingFound error will be raised. """ if self.real_client is None: - if isinstance(url, (str, unicode)): + if isinstance(url, str): url = atom.url.parse_url(url) for recording in self.recordings: if recording[0].operation == operation and recording[0].url == url: --- ./samples/apps/marketplace_sample/atom/http_interface.py (original) +++ ./samples/apps/marketplace_sample/atom/http_interface.py (refaRefactoringTool: Refactored ./samples/apps/marketplace_sample/atom/http_core.py ctored) @@ -33,7 +33,7 @@ __author__ = 'api.jscudder (Jeff Scudder)' -import StringIO +import io USER_AGENT = '%s GData-Python/2.0.15' @@ -74,7 +74,7 @@ if hasattr(body, 'read'): self._body = body else: - self._body = StringIO.StringIO(body) + self._body = io.StringIO(body) else: self._body = None if status is not None: --- ./samples/apps/marketplace_sample/atom/http_core.py (original) +++ ./samples/apps/marketplace_sample/atom/http_core.py (refactored) @@ -23,10 +23,10 @@ import os -import StringIO -import urlparse -import urllib -import httplib +import io +import urllib.parse +import urllib.request, urllib.parse, urllib.error +import http.client ssl = None try: import ssl @@ -97,7 +97,7 @@ self._body_parts = [] if method is not None: self.method = method - if isinstance(uri, (str, unicode)): + if isinstance(uri, str): uri = Uri.parse_uri(uri) self.uri = uri or Uri() @@ -184,7 +184,7 @@ mime_type: str The MIME type of the form data being sent. Defaults to 'application/x-www-form-urlencoded'. """ - body = urllib.urlencode(form_data) + body = urllib.parse.urlencode(form_data) self.add_body_part(body, mime_type) AddFormInputs = add_form_inputs @@ -206,12 +206,12 @@ """ output = 'HTTP Request\n method: %s\n url: %s\n headers:\n' % ( self.method, str(self.uri)) - for header, value in self.headers.iteritems(): + for header, value in self.headers.items(): output += ' %s: %s\n' % (header, value) output += ' body sections:\n' i = 0 for part in self._body_parts: - if isinstance(part, (str, unicode)): + if isinstance(part, str): output += ' %s: %s\n' % (i, part) else: output += ' %s: \n' % i @@ -260,9 +260,9 @@ def _get_query_string(self): param_pairs = [] - for key, value in self.query.iteritems(): - param_pairs.append('='.join((urllib.quote_plus(key), - urllib.quote_plus(str(value))))) + for key, value in self.query.items(): + param_pairs.append('='.join((urllib.parse.quote_plus(key), + urllib.parse.quote_plus(str(value))))) return '&'.join(param_pairs) def _get_relative_path(self): @@ -325,7 +325,7 @@ This method can accept partial URIs, but it will leave missing members of the Uri unset. """ - parts = urlparse.urlparse(uri_string) + parts = urllib.parse.urlparse(uri_string) uri = Uri() if parts[0]: uri.scheme = parts[0] @@ -342,10 +342,10 @@ for pair in param_pairs: pair_parts = pair.split('=') if len(pair_parts) > 1: - uri.query[urllib.unquote_plus(pair_parts[0])] = ( - urllib.unquote_plus(pair_parts[1])) + uri.query[urllib.parse.unquote_plus(pair_parts[0])] = ( + urllib.parse.unquote_plus(pair_parts[1])) elif len(pair_parts) == 1: - uri.query[urllib.unquote_plus(pair_parts[0])] = None + uri.query[urllib.parse.unquote_plus(pair_parts[0])] = None return uri parse_uri = staticmethod(parse_uri) @@ -374,7 +374,7 @@ if hasattr(body, 'read'): self._body = body else: - self._body = StringIO.StringIO(body) + self._body = io.StringIO(body) def getheader(self, name, default=None): if name in self._headers: @@ -403,7 +403,7 @@ http_response.status, http_response.reason) headers = get_headers(http_response) if isinstance(headers, dict): - for header, value in headers.iteritems(): + for header, value in headers.items(): output += ' %s: %s\n' % (header, value) else: for pair in headers: @@ -432,14 +432,14 @@ connection = None if uri.scheme == 'https': if not uri.port: - connection = httplib.HTTPSConnection(uri.host) + connection = http.client.HTTPSConnection(uri.host) else: - connection = httplib.HTTPSConnection(uri.host, int(uri.port)) + connectRefactoringTool: Refactored ./samples/apps/marketplace_sample/atom/http.py ion = http.client.HTTPSConnection(uri.host, int(uri.port)) else: if not uri.port: - connection = httplib.HTTPConnection(uri.host) + connection = http.client.HTTPConnection(uri.host) else: - connection = httplib.HTTPConnection(uri.host, int(uri.port)) + connection = http.client.HTTPConnection(uri.host, int(uri.port)) return connection def _http_request(self, method, uri, headers=None, body_parts=None): @@ -454,7 +454,7 @@ which can be converted to strings using str. Each of these will be sent in order as the body of the HTTP request. """ - if isinstance(uri, (str, unicode)): + if isinstance(uri, str): uri = Uri.parse_uri(uri) connection = self._get_connection(uri, headers=headers) @@ -484,12 +484,12 @@ pass # Send the HTTP headers. - for header_name, value in headers.iteritems(): + for header_name, value in headers.items(): connection.putheader(header_name, value) connection.endheaders() # If there is data, send it in the request. - if body_parts and filter(lambda x: x != '', body_parts): + if body_parts and [x for x in body_parts if x != '']: for part in body_parts: _send_data_part(part, connection) @@ -498,7 +498,7 @@ def _send_data_part(data, connection): - if isinstance(data, (str, unicode)): + if isinstance(data, str): # I might want to just allow str, not unicode. connection.send(data) return @@ -566,9 +566,9 @@ sslobj = ssl.wrap_socket(p_sock, None, None) else: sock_ssl = socket.ssl(p_sock, None, Nonesock_) - sslobj = httplib.FakeSocket(p_sock, sock_ssl) + sslobj = http.client.FakeSocket(p_sock, sock_ssl) # Initalize httplib and replace with the proxy socket. - connection = httplib.HTTPConnection(proxy_uri.host) + connection = http.client.HTTPConnection(proxy_uri.host) connection.sock = sslobj return connection elif uri.scheme == 'http': @@ -577,7 +577,7 @@ proxy_uri.port = '80' if proxy_auth: headers['Proxy-Authorization'] = proxy_auth.strip() - return httplib.HTTPConnection(proxy_uri.host, int(proxy_uri.port)) + return http.client.HTTPConnection(proxy_uri.host, int(proxy_uri.port)) return None --- ./samples/apps/marketplace_sample/atom/http.py (original) +++ ./samples/apps/marketplace_sample/atom/http.py (refactored) @@ -37,7 +37,7 @@ import types import os -import httplib +import http.client import atom.url import atom.http_interface import socket @@ -103,7 +103,7 @@ # If the list of headers does not include a Content-Length, attempt to # calculate it based on the data object. if data and 'Content-Length' not in all_headers: - if isinstance(data, types.StringTypes): + if isinstance(data, (str,)): all_headers['Content-Length'] = str(len(data)) else: raise atom.http_interface.ContentLengthRequired('Unable to calculate ' @@ -123,7 +123,7 @@ return self.v2_http_client.request(http_request=http_request) if not isinstance(url, atom.url.Url): - if isinstance(url, types.StringTypes): + if isinstance(url, (str,)): url = atom.url.parse_url(url) else: raise atom.http_interface.UnparsableUrlObject('Unable to parse url ' @@ -175,19 +175,19 @@ def _prepare_connection(self, url, headers): if not isinstance(url, atom.url.Url): - if isinstance(url, types.StringTypes): + if isinstance(url, (str,)): url = atom.url.parse_url(url) else: raise atom.http_interface.UnparsableUrlObject('Unable to parse url ' 'parameter because it was not a string or atom.url.Url') if url.protocol == 'https': if not url.port: - return httplib.HTTPSConnection(url.host) - return httplib.HTTPSConnection(url.host, int(url.port)) + return http.client.HTTPSConnection(url.host) + return http.client.HTTPSConnection(url.host, int(url.port)) RefactoringTool: No changes to ./samples/apps/marketplace_sample/atom/data.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/atom/core.py else: if not url.port: - return httplib.HTTPConnection(url.host) - return httplib.HTTPConnection(url.host, int(url.port)) + return http.client.HTTPConnection(url.host) + return http.client.HTTPConnection(url.host, int(url.port)) def _get_access_url(self, url): return url.to_string() @@ -259,10 +259,10 @@ sslobj = ssl.wrap_socket(p_sock, None, None) else: sock_ssl = socket.ssl(p_sock, None, None) - sslobj = httplib.FakeSocket(p_sock, sock_ssl) + sslobj = http.client.FakeSocket(p_sock, sock_ssl) # Initalize httplib and replace with the proxy socket. - connection = httplib.HTTPConnection(proxy_url.host) + connection = http.client.HTTPConnection(proxy_url.host) connection.sock = sslobj return connection else: @@ -275,7 +275,7 @@ if proxy_auth: headers['Proxy-Authorization'] = proxy_auth.strip() - return httplib.HTTPConnection(proxy_url.host, int(proxy_url.port)) + return http.client.HTTPConnection(proxy_url.host, int(proxy_url.port)) def _get_access_url(self, url): return url.to_string() @@ -343,7 +343,7 @@ def _send_data_part(data, connection): - if isinstance(data, types.StringTypes): + if isinstance(data, (str,)): connection.send(data) return # Check to see if data is a file-like object that has a read method. --- ./samples/apps/marketplace_sample/atom/core.py (original) +++ ./samples/apps/marketplace_sample/atom/core.py (refactored) @@ -93,7 +93,7 @@ if not pair[0].startswith('_') and pair[0] != 'text': member_type = pair[1] if (isinstance(member_type, tuple) or isinstance(member_type, list) - or isinstance(member_type, (str, unicode)) + or isinstance(member_type, str) or (inspect.isclass(member_type) and issubclass(member_type, XmlElement))): members.append(pair) @@ -173,7 +173,7 @@ attributes[target[version-1]] = member_name else: attributes[target[-1]] = member_name - elif isinstance(target, (str, unicode)): + elif isinstance(target, str): # This member points to an XML attribute. attributes[target] = member_name elif issubclass(target, XmlElement): @@ -207,7 +207,7 @@ matches = [] ignored1, elements, ignored2 = self.__class__._get_rules(version) if elements: - for qname, element_def in elements.iteritems(): + for qname, element_def in elements.items(): member = getattr(self, element_def[0]) if member: if _qname_matches(tag, namespace, qname): @@ -253,7 +253,7 @@ matches = [] ignored1, ignored2, attributes = self.__class__._get_rules(version) if attributes: - for qname, attribute_def in attributes.iteritems(): + for qname, attribute_def in attributes.items(): if isinstance(attribute_def, (list, tuple)): attribute_def = attribute_def[0] member = getattr(self, attribute_def) @@ -262,7 +262,7 @@ if member: if _qname_matches(tag, namespace, qname): matches.append(XmlAttribute(qname, member)) - for qname, value in self._other_attributes.iteritems(): + for qname, value in self._other_attributes.items(): if _qname_matches(tag, namespace, qname): matches.append(XmlAttribute(qname, value)) return matches @@ -288,7 +288,7 @@ else: self._other_elements.append(_xml_element_from_tree(element, XmlElement, version)) - for attrib, value in tree.attrib.iteritems(): + for attrib, value in tree.attrib.items(): if attributes and attrib in attributes: setattr(self, attributes[attrib], value) else: @@ -318,7 +318,7 @@ encoding = encoding or STRING_ENCODING # Add the expected elements and attributes to the tree. if elements: - for tag, element_def in elements.iteritems(): + fRefactoringTool: Refactored ./samples/apps/marketplace_sample/atom/client.py RefactoringTool: No changes to ./samples/apps/marketplace_sample/atom/auth.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/atom/__init__.py or tag, element_def in elements.items(): member = getattr(self, element_def[0]) # If this is a repeating element and there are members in the list. if member and element_def[2]: @@ -327,21 +327,21 @@ elif member: member._become_child(tree, version) if attributes: - for attribute_tag, member_name in attributes.iteritems(): + for attribute_tag, member_name in attributes.items(): value = getattr(self, member_name) if value: tree.attrib[attribute_tag] = value # Add the unexpected (other) elements and attributes to the tree. for element in self._other_elements: element._become_child(tree, version) - for key, value in self._other_attributes.iteritems(): + for key, value in self._other_attributes.items(): # I'm not sure if unicode can be used in the attribute name, so for now # we assume the encoding is correct for the attribute name. - if not isinstance(value, unicode): + if not isinstance(value, str): value = value.decode(encoding) tree.attrib[key] = value if self.text: - if isinstance(self.text, unicode): + if isinstance(self.text, str): tree.text = self.text else: tree.text = self.text.decode(encoding) @@ -512,7 +512,7 @@ """ if target_class is None: target_class = XmlElement - if isinstance(xml_string, unicode): + if isinstance(xml_string, str): if encoding is None: xml_string = xml_string.encode(STRING_ENCODING) else: --- ./samples/apps/marketplace_sample/atom/client.py (original) +++ ./samples/apps/marketplace_sample/atom/client.py (refactored) @@ -85,15 +85,15 @@ # Modify the request based on the AtomPubClient settings and parameters # passed in to the request. http_request = self.modify_request(http_request) - if isinstance(uri, (str, unicode)): + if isinstance(uri, str): uri = atom.http_core.Uri.parse_uri(uri) if uri is not None: uri.modify_request(http_request) - if isinstance(method, (str, unicode)): + if isinstance(method, str): http_request.method = method # Any unrecognized arguments are assumed to be capable of modifying the # HTTP request. - for name, value in kwargs.iteritems(): + for name, value in kwargs.items(): if value is not None: value.modify_request(http_request) # Default to an http request if the protocol scheme is not set. @@ -215,7 +215,7 @@ An atom.http_core.HttpRequest() with the added custom headers. """ - for name, value in self.headers.iteritems(): + for name, value in self.headers.items(): if value is not None: http_request.headers[name] = value return http_request --- ./samples/apps/marketplace_sample/atom/__init__.py (original) +++ ./samples/apps/marketplace_sample/atom/__init__.py (refactored) @@ -94,7 +94,7 @@ # Preserve the original name to avoid masking all decorated functions as # 'deprecated_function' try: - optional_warn_function.func_name = f.func_name + optional_warn_function.__name__ = f.__name__ except TypeError: pass # In Python2.3 we can't set the func_name return optional_warn_function @@ -122,7 +122,7 @@ match those of the target class. """ encoding = string_encoding or XML_STRING_ENCODING - if encoding and isinstance(xml_string, unicode): + if encoding and isinstance(xml_string, str): xml_string = xml_string.encode(encoding) tree = ElementTree.fromstring(xml_string) return _CreateClassFromElementTree(target_class, tree) @@ -184,11 +184,11 @@ # Fill in the instance members from the contents of the XML tree. for child in tree: self._ConvertElementTreeToMember(child) - for attribute, value in tree.attrib.iteritems(): + for attribute, value in tree.attrib.items(): self._ConvertElementAttributeToMember(attribute, value) # Encode the text string according to the desired encoding type. (UTF-8) if tree.text: - if MEMBER_STRING_ENCODING is unicode: + if MEMBER_STRING_ENCODING is str: self.text = tree.text else: self.text = tree.text.encode(MEMBER_STRING_ENCODING) @@ -200,7 +200,7 @@ def _ConvertElementAttributeToMember(self, attribute, value): # Encode the attribute value's string with the desired type Default UTF-8 if value: - if MEMBER_STRING_ENCODING is unicode: + if MEMBER_STRING_ENCODING is str: self.extension_attributes[attribute] = value else: self.extension_attributes[attribute] = value.encode( @@ -210,15 +210,15 @@ def _AddMembersToElementTree(self, tree): for child in self.extension_elements: child._BecomeChildElement(tree) - for attribute, value in self.extension_attributes.iteritems(): + for attribute, value in self.extension_attributes.items(): if value: - if isinstance(value, unicode) or MEMBER_STRING_ENCODING is unicode: + if isinstance(value, str) or MEMBER_STRING_ENCODING is str: tree.attrib[attribute] = value else: # Decode the value from the desired encoding (default UTF-8). tree.attrib[attribute] = value.decode(MEMBER_STRING_ENCODING) if self.text: - if isinstance(self.text, unicode) or MEMBER_STRING_ENCODING is unicode: + if isinstance(self.text, str) or MEMBER_STRING_ENCODING is str: tree.text = self.text else: tree.text = self.text.decode(MEMBER_STRING_ENCODING) @@ -279,7 +279,7 @@ def _ConvertElementTreeToMember(self, child_tree): # Find the element's tag in this class's list of child members - if self.__class__._children.has_key(child_tree.tag): + if child_tree.tag in self.__class__._children: member_name = self.__class__._children[child_tree.tag][0] member_class = self.__class__._children[child_tree.tag][1] # If the class member is supposed to contain a list, make sure the @@ -298,13 +298,13 @@ def _ConvertElementAttributeToMember(self, attribute, value): # Find the attribute in this class's list of attributes. - if self.__class__._attributes.has_key(attribute): + if attribute in self.__class__._attributes: # Find the member of this class which corresponds to the XML attribute # (lookup in current_class._attributes) and set this member to the # desired value (using self.__dict__). if value: # Encode the string to capture non-ascii characters (default UTF-8) - if MEMBER_STRING_ENCODING is unicode: + if MEMBER_STRING_ENCODING is str: setattr(self, self.__class__._attributes[attribute], value) else: setattr(self, self.__class__._attributes[attribute], @@ -319,7 +319,7 @@ # This uses the class's _children dictionary to find the members which # should become XML child nodes. member_node_names = [values[0] for tag, values in - self.__class__._children.iteritems()] + self.__class__._children.items()] for member_name in member_node_names: member = getattr(self, member_name) if member is None: @@ -330,10 +330,10 @@ else: member._BecomeChildElement(tree) # Convert the members of this class which are XML attributes. - for xml_attribute, member_name in self.__class__._attributes.iteritems(): + for xml_attribute, member_name in self.__class__._attributes.items(): member = getattr(self, member_name) if member is not None: - if isinstance(member, unicode) or MEMBER_STRING_ENCODING is unicode: + if isinstance(member, str) or MEMBER_STRING_ENCODING is str: tree.attrib[xml_attribute] = member else: tree.attrib[xml_attribute] = member.decode(MEMBER_STRING_ENCODING) @@ -1375,7 +1375,7 @@ else: element_tree.tag = self.tag - for key, value in self.attributes.iteritems(): + for key, value in self.attributes.items(): element_tree.attrib[key] = value for child in self.children: @@ -145RefactoringTool: Refactored ./samples/apps/marketplace_sample/appengine_utilities/settings_default.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/appengine_utilities/sessions.py 2,7 +1452,7 @@ namespace = None tag = element_tag extension = ExtensionElement(namespace=namespace, tag=tag) - for key, value in element_tree.attrib.iteritems(): + for key, value in element_tree.attrib.items(): extension.attributes[key] = value for child in element_tree: extension.children.append(_ExtensionElementFromElementTree(child)) @@ -1476,7 +1476,7 @@ # Preserve the original name to avoid masking all decorated functions as # 'deprecated_function' try: - deprecated_function.func_name = f.func_name + deprecated_function.__name__ = f.__name__ except TypeError: # Setting the func_name is not allowed in Python2.3. pass --- ./samples/apps/marketplace_sample/appengine_utilities/settings_default.py (original) +++ ./samples/apps/marketplace_sample/appengine_utilities/settings_default.py (refactored) @@ -77,5 +77,5 @@ "RETRY_INTERVAL": .2, } if __name__ == "__main__": - print "Hello World"; + print("Hello World"); --- ./samples/apps/marketplace_sample/appengine_utilities/sessions.py (original) +++ ./samples/apps/marketplace_sample/appengine_utilities/sessions.py (refactored) @@ -32,7 +32,7 @@ import datetime import random import hashlib -import Cookie +import http.cookies import pickle import sys import logging @@ -46,7 +46,7 @@ # settings try: - import settings_default + from . import settings_default import settings if settings.__name__.rsplit('.', 1)[0] != settings_default.__name__.rsplit('.', 1)[0]: @@ -79,7 +79,7 @@ Returns the session object. """ try: - memcache.set(u"_AppEngineUtilities_Session_%s" % \ + memcache.set("_AppEngineUtilities_Session_%s" % \ (str(self.key())), self) except: # new session, generate a new key, which will handle the @@ -91,11 +91,11 @@ try: self.dirty = False db.put(self) - memcache.set(u"_AppEngineUtilities_Session_%s" % \ + memcache.set("_AppEngineUtilities_Session_%s" % \ (str(self.key())), self) except: self.dirty = True - memcache.set(u"_AppEngineUtilities_Session_%s" % \ + memcache.set("_AppEngineUtilities_Session_%s" % \ (str(self.key())), self) return self @@ -113,8 +113,8 @@ """ if session_obj.sid == None: return None - session_key = session_obj.sid.split(u'_')[0] - session = memcache.get(u"_AppEngineUtilities_Session_%s" % \ + session_key = session_obj.sid.split('_')[0] + session = memcache.get("_AppEngineUtilities_Session_%s" % \ (str(session_key))) if session: if session.deleted == True: @@ -125,7 +125,7 @@ # which can happen with ajax oriented sites, don't try to put # at the same time session.working = True - memcache.set(u"_AppEngineUtilities_Session_%s" % \ + memcache.set("_AppEngineUtilities_Session_%s" % \ (str(session_key)), session) session.put() if session_obj.sid in session.sid: @@ -145,9 +145,9 @@ if sessionAge.seconds > session_obj.session_expire_time: ds_session.delete() return None - memcache.set(u"_AppEngineUtilities_Session_%s" % \ + memcache.set("_AppEngineUtilities_Session_%s" % \ (str(session_key)), ds_session) - memcache.set(u"_AppEngineUtilities_SessionData_%s" % \ + memcache.set("_AppEngineUtilities_SessionData_%s" % \ (str(session_key)), ds_session.get_items_ds()) return ds_session @@ -157,7 +157,7 @@ Returns all the items stored in a session. Queries memcache first and will try the datastore next. """ - items = memcache.get(u"_AppEngineUtilities_SessionData_%s" % \ + items = memcache.get("_AppEngineUtilities_SessionData_%s" % \ (str(self.key()))) if items: for item in items: @@ -167,7 +167,7 @@ return items query = _AppEngineUtilities_SessionData.all() - query.filter(u"session", self) + query.filter("session", self) results = query.fetch(1000) return results @@ -180,7 +180,7 @@ Returns the session data object if it exists, otherwise returns None """ - mc = memcache.get(u"_AppEngineUtilities_SessionData_%s" % \ + mc = memcache.get("_AppEngineUtilities_SessionData_%s" % \ (str(self.key()))) if mc: for item in mc: @@ -190,11 +190,11 @@ return None return item query = _AppEngineUtilities_SessionData.all() - query.filter(u"session = ", self) - query.filter(u"keyname = ", keyname) + query.filter("session = ", self) + query.filter("keyname = ", keyname) results = query.fetch(1) if len(results) > 0: - memcache.set(u"_AppEngineUtilities_SessionData_%s" % \ + memcache.set("_AppEngineUtilities_SessionData_%s" % \ (str(self.key())), self.get_items_ds()) return results[0] return None @@ -207,7 +207,7 @@ Returns a list of session data entities. """ query = _AppEngineUtilities_SessionData.all() - query.filter(u"session", self) + query.filter("session", self) results = query.fetch(1000) return results @@ -220,28 +220,28 @@ """ try: query = _AppEngineUtilities_SessionData.all() - query.filter(u"session = ", self) + query.filter("session = ", self) results = query.fetch(1000) db.delete(results) db.delete(self) - memcache.delete_multi([u"_AppEngineUtilities_Session_%s" % \ + memcache.delete_multi(["_AppEngineUtilities_Session_%s" % \ (str(self.key())), \ - u"_AppEngineUtilities_SessionData_%s" % \ + "_AppEngineUtilities_SessionData_%s" % \ (str(self.key()))]) except: - mc = memcache.get(u"_AppEngineUtilities_Session_%s" %+ \ + mc = memcache.get("_AppEngineUtilities_Session_%s" %+ \ (str(self.key()))) if mc: mc.deleted = True else: # not in the memcache, check to see if it should be query = _AppEngineUtilities_Session.all() - query.filter(u"sid = ", self.sid) + query.filter("sid = ", self.sid) results = query.fetch(1) if len(results) > 0: results[0].deleted = True - memcache.set(u"_AppEngineUtilities_Session_%s" % \ - (unicode(self.key())), results[0]) + memcache.set("_AppEngineUtilities_Session_%s" % \ + (str(self.key())), results[0]) return True class _AppEngineUtilities_SessionData(db.Model): @@ -268,11 +268,11 @@ return_val = db.put(self) self.dirty = False except: - return_val = u"dirty" + return_val = "dirty" self.dirty = True # update or insert in memcache - mc_items = memcache.get(u"_AppEngineUtilities_SessionData_%s" % \ + mc_items = memcache.get("_AppEngineUtilities_SessionData_%s" % \ (str(self.session.key()))) if mc_items: value_updated = False @@ -282,13 +282,13 @@ if item.keyname == self.keyname: item.content = self.content item.model = self.model - memcache.set(u"_AppEngineUtilities_SessionData_%s" % \ + memcache.set("_AppEngineUtilities_SessionData_%s" % \ (str(self.session.key())), mc_items) value_updated = True break if value_updated == False: mc_items.append(self) - memcache.set(u"_AppEngineUtilities_SessionData_%s" % \ + memcache.set("_AppEngineUtilities_SessionData_%s" % \ (str(self.session.key())), mc_items) return return_val @@ -302,7 +302,7 @@ db.delete(self) except: self.deleted = True - mc_items = memcache.get(u"_AppEngineUtilities_SessionData_%s" % \ + mc_items = memcache.get("_AppEngineUtilities_SessionData_%s" % \ (str(self.session.key()))) value_handled = False for item in mc_items: @@ -313,7 +313,7 @@ item.deleted = True else: mc_items.remove(item) - memcache.set(u"_AppEngineUtilities_SessionData_%s" % \ + memcache.set("_AppEngineUtilities_SessionData_%s" % \ (str(self.session.key())), mc_items) return True @@ -332,12 +332,12 @@ """ keyname = session._validate_key(keyname) if value is None: - raise ValueError(u"You must pass a value to put.") + raise ValueError("You must pass a value to put.") # datestore write trumps cookie. If there is a cookie value # with this keyname, delete it so we don't have conflicting # entries. - if session.cookie_vals.has_key(keyname): + if keyname in session.cookie_vals: del(session.cookie_vals[keyname]) session.output_cookie["%s_data" % (session.cookie_name)] = \ simplejson.dumps(session.cookie_vals) @@ -346,7 +346,7 @@ if session.cookie_domain: session.output_cookie["%s_data" % \ (session.cookie_name)]["domain"] = session.cookie_domain - print session.output_cookie.output() + print(session.output_cookie.output()) sessdata = session._get(keyname=keyname) if sessdata is None: @@ -380,7 +380,7 @@ """ keyname = session._validate_key(keyname) if value is None: - raise ValueError(u"You must pass a value to put.") + raise ValueError("You must pass a value to put.") # Use simplejson for cookies instead of pickle. session.cookie_vals[keyname] = value @@ -395,7 +395,7 @@ if session.cookie_domain: session.output_cookie["%s_data" % \ (session.cookie_name)]["domain"] = session.cookie_domain - print session.output_cookie.output() + print(session.output_cookie.output()) return True class Session(object): @@ -521,12 +521,12 @@ self.writer = writer # make sure the page is not cached in the browser - print self.no_cache_headers() + print(self.no_cache_headers()) # Check the cookie and, if necessary, create a new one. self.cache = {} - string_cookie = os.environ.get(u"HTTP_COOKIE", u"") - self.cookie = Cookie.SimpleCookie() - self.output_cookie = Cookie.SimpleCookie() + string_cookie = os.environ.get("HTTP_COOKIE", "") + self.cookie = http.cookies.SimpleCookie() + self.output_cookie = http.cookies.SimpleCookie() if string_cookie == "": self.cookie_vals = {} else: @@ -541,7 +541,7 @@ # sync the input cookie with the output cookie self.output_cookie["%s_data" % (self.cookie_name)] = \ simplejson.dumps(self.cookie_vals) #self.cookie["%s_data" % (self.cookie_name)] - except Exception, e: + except Exception as e: self.cookie_vals = {} @@ -568,11 +568,11 @@ self.session = _AppEngineUtilities_Session() self.session.put() self.sid = self.new_sid() - if u"HTTP_USER_AGENT" in os.environ: - self.session.ua = os.environ[u"HTTP_USER_AGENT"] + if "HTTP_USER_AGENT" in os.environ: + self.session.ua = os.environ["HTTP_USER_AGENT"] else: self.session.ua = None - if u"REMOTE_ADDR" in os.environ: + if "REMOTE_ADDR" in os.environ: self.session.ip = os.environ["REMOTE_ADDR"] else: self.session.ip = None @@ -606,22 +606,22 @@ self.output_cookie[cookie_name]["expires"] = \ self.session_expire_time - self.cache[u"sid"] = self.sid + self.cache["sid"] = self.sid if do_put: - if self.sid != None or self.sid != u"": + if self.sid != None or self.sid != "": self.session.put() if self.set_cookie_expires: - if not self.output_cookie.has_key("%s_data" % (cookie_name)): - self.output_cookie["%s_data" % (cookie_name)] = u"" + if "%s_data" % (cookie_name) not in self.output_cookie: + self.output_cookie["%s_data" % (cookie_name)] = "" self.output_cookie["%s_data" % (cookie_name)]["expires"] = \ self.session_expire_time - print self.output_cookie.output() + print(self.output_cookie.output()) # fire up a Flash object if integration is enabled if self.integrate_flash: - import flash + from . import flash self.flash = flash.Flash(cookie=self.cookie) # randomly delete old stale sessions in the datastore (see @@ -635,9 +635,9 @@ Returns session id as a unicode string. """ - sid = u"%s_%s" % (str(self.session.key()), + sid = "%s_%s" % (str(self.session.key()), hashlib.md5(repr(time.time()) + \ - unicode(random.random())).hexdigest() + str(random.random())).hexdigest() ) #sid = unicode(self.session.session_key) + "_" + \ # hashlib.md5(repr(time.time()) + \ @@ -677,13 +677,13 @@ """ if keyname is None: raise ValueError( - u"You must pass a keyname for the session data content." + "You must pass a keyname for the session data content." ) - elif keyname in (u"sid", u"flash"): - raise ValueError(u"%s is a reserved keyname." % keyname) - - if type(keyname) != type([str, unicode]): - return unicode(keyname) + elif keyname in ("sid", "flash"): + raise ValueError("%s is a reserved keyname." % keyname) + + if type(keyname) != type([str, str]): + return str(keyname) return keyname def _put(self, keyname, value): @@ -712,9 +712,9 @@ Returns True. """ # if the event class has been loaded, fire off the preSessionDelete event - if u"AEU_Events" in sys.modules['__main__'].__dict__: - sys.modules['__main__'].AEU_Events.fire_event(u"preSessionDelete") - if hasattr(self, u"session"): + if "AEU_Events" in sys.modules['__main__'].__dict__: + sys.modules['__main__'].AEU_Events.fire_event("preSessionDelete") + if hasattr(self, "session"): self.session.delete() self.cookie_vals = {} self.cache = {} @@ -726,10 +726,10 @@ self.output_cookie["%s_data" % \ (self.cookie_name)]["domain"] = self.cookie_domain - print self.output_cookie.output() + print(self.output_cookie.output()) # if the event class has been loaded, fire off the sessionDelete event - if u"AEU_Events" in sys.modules['__main__'].__dict__: - sys.modules['__main__'].AEU_Events.fire_event(u"sessionDelete") + if "AEU_Events" in sys.modules['__main__'].__dict__: + sys.modules['__main__'].AEU_Events.fire_event("sessionDelete") return True def delete(self): @@ -800,7 +800,7 @@ duration = datetime.timedelta(seconds=session_expire_time) session_age = datetime.datetime.now() - duration query = _AppEngineUtilities_Session.all() - query.filter(u"last_activity <", session_age) + query.filter("last_activity <", session_age) results = query.fetch(50) for result in results: result.delete() @@ -836,11 +836,11 @@ Returns a unicode string of headers. """ - return u"".join([u"Expires: Tue, 03 Jul 2001 06:00:00 GMT", + return "".join(["Expires: Tue, 03 Jul 2001 06:00:00 GMT", strftime("Last-Modified: %a, %d %b %y %H:%M:%S %Z").decode("utf-8"), - u"Cache-Control: no-store, no-cache, must-revalidate, max-age=0", - u"Cache-Control: post-check=0, pre-check=0", - u"Pragma: no-cache", + "Cache-Control: no-store, no-cache, must-revalidate, max-age=0", + "Cache-Control: post-check=0, pre-check=0", + "Pragma: no-cache", ]) def clear(self): @@ -867,7 +867,7 @@ self.output_cookie["%s_data" % \ (self.cookie_name)]["domain"] = self.cookie_domain - print self.output_cookie.output() + print(self.output_cookie.output()) return True def has_key(self, keyname): @@ -978,21 +978,21 @@ Returns True/False """ - string_cookie = os.environ.get(u"HTTP_COOKIE", u"") - cookie = Cookie.SimpleCookie() + string_cookie = os.environ.get("HTTP_COOKIE", "") + cookie = http.cookies.SimpleCookie() cookie.load(string_cookie) - if cookie.has_key(cookie_name): + if cookie_name in cookie: query = _AppEngineUtilities_Session.all() - query.filter(u"sid", cookie[cookie_name].value) + query.filter("sid", cookie[cookie_name].value) results = query.fetch(1) if len(results) > 0: return True else: if delete_invalid: - output_cookie = Cookie.SimpleCookie() + output_cookie = http.cookies.SimpleCookie() output_cookie[cookie_name] = cookie[cookie_name] - output_cookie[cookie_name][u"expires"] = 0 - print output_cookie.output() + output_cookie[cookie_name]["expires"] = 0 + print(output_cookie.output()) return False def get_ds_entity(self): @@ -1001,7 +1001,7 @@ exists, otherwise will return None (as in the case of cookie writer session. """ - if hasattr(self, u"session"): + if hasattr(self, "session"): return self.session return None @@ -1015,13 +1015,13 @@ """ # flash messages don't go in the datastore - if self.integrate_flash and (keyname == u"flash"): + if self.integrate_flash and (keyname == "flash"): return self.flash.msg if keyname in self.cache: return self.cache[keyname] if keyname in self.cookie_vals: return self.cookie_vals[keyname] - if hasattr(self, u"session"): + if hasattr(self, "session"): data = self._get(keyname) if data: # TODO: It's broke here, but I'm not sure why, it's @@ -1038,8 +1038,8 @@ self.delete_item(keyname) else: - raise KeyError(unicode(keyname)) - raise KeyError(unicode(keyname)) + raise KeyError(str(keyname)) + raise KeyError(str(keyname)) def __setitem__(self, keyname, value): """ @@ -1050,7 +1050,7 @@ value: The value of mapping. """ - if self.integrate_flash and (keyname == u"flash"): + if self.integrate_flash and (keyname == "flash"): self.flash.msg = value else: keyname = self._validate_key(keyname) @@ -1101,9 +1101,9 @@ self.output_cookie["%s_data" % \ (self.cookie_name)]["domain"] = sRefactoringTool: Refactored ./samples/apps/marketplace_sample/appengine_utilities/rotmodel.py RefactoringTool: No changes to ./samples/apps/marketplace_sample/appengine_utilities/interface/main.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/appengine_utilities/flash.py elf.cookie_domain - print self.output_cookie.output() + print(self.output_cookie.output()) if bad_key: - raise KeyError(unicode(keyname)) + raise KeyError(str(keyname)) if keyname in self.cache: del self.cache[keyname] @@ -1112,7 +1112,7 @@ Return size of session. """ # check memcache first - if hasattr(self, u"session"): + if hasattr(self, "session"): results = self._get() if results is not None: return len(results) + len(self.cookie_vals) @@ -1138,7 +1138,7 @@ Iterate over the keys in the session data. """ # try memcache first - if hasattr(self, u"session"): + if hasattr(self, "session"): vals = self._get() if vals is not None: for k in vals: @@ -1150,4 +1150,4 @@ """ Return string representation. """ - return u"{%s}" % ', '.join(['"%s" = "%s"' % (k, self[k]) for k in self]) + return "{%s}" % ', '.join(['"%s" = "%s"' % (k, self[k]) for k in self]) --- ./samples/apps/marketplace_sample/appengine_utilities/rotmodel.py (original) +++ ./samples/apps/marketplace_sample/appengine_utilities/rotmodel.py (refactored) @@ -31,7 +31,7 @@ # settings try: - import settings_default + from . import settings_default import settings if settings.__name__.rsplit('.', 1)[0] != settings_default.__name__.rsplit('.', 1)[0]: @@ -80,7 +80,7 @@ def get_by_key_name(cls, key_names, parent=None): if isinstance(parent, db.Model): parent = parent.key() - key_names, multiple = datastore.NormalizeAndTypeCheck(key_names, basestring) + key_names, multiple = datastore.NormalizeAndTypeCheck(key_names, str) keys = [datastore.Key.from_path(cls.kind(), name, parent=parent) for name in key_names] count = 0 --- ./samples/apps/marketplace_sample/appengine_utilities/flash.py (original) +++ ./samples/apps/marketplace_sample/appengine_utilities/flash.py (refactored) @@ -26,14 +26,14 @@ """ import os -import Cookie +import http.cookies from time import strftime from django.utils import simplejson # settings try: - import settings_default + from . import settings_default import settings if settings.__name__.rsplit('.', 1)[0] != settings_default.__name__.rsplit('.', 1)[0]: @@ -72,11 +72,11 @@ """ Load the flash message and clear the cookie. """ - print self.no_cache_headers() + print(self.no_cache_headers()) # load cookie if cookie is None: browser_cookie = os.environ.get('HTTP_COOKIE', '') - self.cookie = Cookie.SimpleCookie() + self.cookie = http.cookies.SimpleCookie() self.cookie.load(browser_cookie) else: self.cookie = cookie @@ -96,7 +96,7 @@ self.cookie[COOKIE_NAME] = '' self.cookie[COOKIE_NAME]['path'] = '/' self.cookie[COOKIE_NAME]['expires'] = 0 - print self.cookie[COOKIE_NAME] + print(self.cookie[COOKIE_NAME]) else: # default 'msg' attribute to None self.__dict__['msg'] = None @@ -111,7 +111,7 @@ self.__dict__['msg'] = value self.__dict__['cookie'][COOKIE_NAME] = simplejson.dumps(value) self.__dict__['cookie'][COOKIE_NAME]['path'] = '/' - print self.cookie + print(self.cookie) else: raise ValueError('You can only set the "msg" attribute.') @@ -122,9 +122,9 @@ Returns a unicode string of headers. """ - return u"".join([u"Expires: Tue, 03 Jul 2001 06:00:00 GMT", + return "".join(["Expires: Tue, 03 Jul 2001 06:00:00 GMT", strftime("Last-Modified: %a, %d %b %y %H:%M:%S %Z").decode("utf-8"), - u"Cache-Control: no-store, no-cache, must-revalidate, max-age=0", - u"Cache-Control: post-chRefactoringTool: No changes to ./samples/apps/marketplace_sample/appengine_utilities/event.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/appengine_utilities/django-middleware/middleware.py RefactoringTool: Refactored ./samples/apps/marketplace_sample/appengine_utilities/cache.py RefactoringTool: Refactored ./samples/apps/list_group_members.py RefactoringTool: Refactored ./samples/apps/groups_provisioning_quick_start_example.py eck=0, pre-check=0", - u"Pragma: no-cache", + "Cache-Control: no-store, no-cache, must-revalidate, max-age=0", + "Cache-Control: post-check=0, pre-check=0", + "Pragma: no-cache", ]) --- ./samples/apps/marketplace_sample/appengine_utilities/django-middleware/middleware.py (original) +++ ./samples/apps/marketplace_sample/appengine_utilities/django-middleware/middleware.py (refactored) @@ -1,4 +1,4 @@ -import Cookie +import http.cookies import os from common.appengine_utilities import sessions @@ -37,15 +37,15 @@ def set_test_cookie(self): string_cookie = os.environ.get('HTTP_COOKIE', '') - self.cookie = Cookie.SimpleCookie() + self.cookie = http.cookies.SimpleCookie() self.cookie.load(string_cookie) self.cookie[self.TEST_COOKIE_NAME] = self.TEST_COOKIE_VALUE - print self.cookie + print(self.cookie) def test_cookie_worked(self): string_cookie = os.environ.get('HTTP_COOKIE', '') - self.cookie = Cookie.SimpleCookie() + self.cookie = http.cookies.SimpleCookie() self.cookie.load(string_cookie) return self.cookie.get(self.TEST_COOKIE_NAME) @@ -53,7 +53,7 @@ def delete_test_cookie(self): string_cookie = os.environ.get('HTTP_COOKIE', '') - self.cookie = Cookie.SimpleCookie() + self.cookie = http.cookies.SimpleCookie() self.cookie.load(string_cookie) self.cookie[self.TEST_COOKIE_NAME] = '' self.cookie[self.TEST_COOKIE_NAME]['path'] = '/' --- ./samples/apps/marketplace_sample/appengine_utilities/cache.py (original) +++ ./samples/apps/marketplace_sample/appengine_utilities/cache.py (refactored) @@ -38,7 +38,7 @@ # settings try: - import settings_default + from . import settings_default import settings if settings.__name__.rsplit('.', 1)[0] != settings_default.__name__.rsplit('.', 1)[0]: --- ./samples/apps/list_group_members.py (original) +++ ./samples/apps/list_group_members.py (refactored) @@ -48,10 +48,10 @@ client_id=client_id, client_secret=client_secret, scope=SCOPE, user_agent=USER_AGENT) uri = token.generate_authorize_url() - print 'Please visit this URL to authorize the application:' - print uri + print('Please visit this URL to authorize the application:') + print(uri) # Get the verification code from the standard input. - code = raw_input('What is the verification code? ').strip() + code = input('What is the verification code? ').strip() token.get_access_token(code) return token @@ -75,8 +75,8 @@ members_list.extend(temp_list) else: members_list.append(member.member_id) - except gdata.client.RequestError, e: - print 'Request error: %s %s %s' % (e.status, e.reason, e.body) + except gdata.client.RequestError as e: + print('Request error: %s %s %s' % (e.status, e.reason, e.body)) return members_list @@ -107,8 +107,8 @@ members_list = ListAllMembers(group_client, options.GROUP_ID) no_duplicate_members_list = list(set(members_list)) - print 'User members of the group %s are: ' % options.GROUP_ID - print no_duplicate_members_list + print('User members of the group %s are: ' % options.GROUP_ID) + print(no_duplicate_members_list) if __name__ == '__main__': --- ./samples/apps/groups_provisioning_quick_start_example.py (original) +++ ./samples/apps/groups_provisioning_quick_start_example.py (refactored) @@ -49,10 +49,10 @@ client_id=self.client_id, client_secret=self.client_secret, scope=SCOPE, user_agent=USER_AGENT) uri = token.generate_authorize_url() - print 'Please visit this URL to authorize the application:' - print uri + print('Please visit this URL to authorize the application:') + print(uri) # Get the verification code from the standard input. - code = raw_input('What is the verification code? ').strip() + code = input('What is the verification code? ').strip() token.get_access_token(code) self.groups_client = gdata.apps.groups.client.GroupsProvisioningClient( domain=self.domain, auth_token=token) @@ -65,7 +65,7 @@ """ group_id = '' while not group_id: - group_id = raw_input('Enter a valid group email address' + group_id = input('Enter a valid group email address' '(group@domain.com): ') return group_id @@ -77,7 +77,7 @@ """ member_id = '' while not member_id: - member_id = raw_input('Enter a valid member email address' + member_id = input('Enter a valid member email address' '(username@domain.com): ') return member_id @@ -87,11 +87,11 @@ Args: group_entry: [GroupEntry] contains all the data about the group. """ - print 'Group ID: ' + group_entry.group_id - print 'Group Name: ' + group_entry.group_name - print 'Description: ' + group_entry.description - print 'Email Permissions: ' + group_entry.email_permission - print '' + print('Group ID: ' + group_entry.group_id) + print('Group Name: ' + group_entry.group_name) + print('Description: ' + group_entry.description) + print('Email Permissions: ' + group_entry.email_permission) + print('') def _PrintMemberDetails(self, member_entry): """Print all the details of a group member. @@ -99,10 +99,10 @@ Args: member_entry: [GroupMemberEntry] contains all the data about the group member. """ - print 'Member ID: ' + member_entry.member_id - print 'Member Type: ' + member_entry.member_type - print 'Is Direct Member: ' + member_entry.direct_member - print '' + print('Member ID: ' + member_entry.member_id) + print('Member Type: ' + member_entry.member_type) + print('Is Direct Member: ' + member_entry.direct_member) + print('') def _TakeGroupData(self, function='create'): """Takes input data for _UpdateGroup and _CreateGroup functions. @@ -121,20 +121,20 @@ group_data = gdata.apps.groups.data.GroupEntry() group_data.group_id = self._GetValidGroupId() while not group_data.group_name: - group_data.group_name = raw_input('Enter name for the group%s: ' + group_data.group_name = input('Enter name for the group%s: ' % extra_stmt) if function == 'update': break - group_data.description = raw_input('Enter description for the group%s: ' + group_data.description = input('Enter description for the group%s: ' % extra_stmt) - print ('Choose an option for email permission%s:' - % extra_stmt) + print(('Choose an option for email permission%s:' + % extra_stmt)) i = 1 for option in email_permission_options: - print '%d - %s' % (i, option) + print('%d - %s' % (i, option)) i += 1 - choice = (raw_input()) + choice = (input()) if not choice: choice = -1 choice = int(choice) @@ -173,7 +173,7 @@ def _RetrieveAllGroupsForMember(self): """Retrieves all the groups the user is a member of.""" member_id = self._GetValidMemberId() - direct_only = raw_input('Write true/false for direct_only: ') + direct_only = input('Write true/false for direct_only: ') if direct_only == 'true': direct_only = True else: @@ -246,14 +246,14 @@ ] while True: - print 'Choose an option:\n0 - to exit' + print('Choose an option:\n0 - to exit') for i in range (0, len(functions_list)): - print '%d - %s' % ((i+1), functions_list[i]['description']) - choice = int(raw_input()) + print('%d - %s' % ((i+1), functions_list[i]['description'])) + choice = int(input()) if choice == 0: break if choice < 0 or choice > len(functions_list): - print 'Not a valid option!' + print('Not a valid option!') continue functions_list[choice-1]['function']() @@ -265,7 +265,7 @@ opts, args = getopt.getopt(sys.argv[1:], '', ['client_id=', 'client_secret=', RefactoringTool: Refactored ./samples/apps/emailsettings_example.py 'domain=']) - except getopt.error, msg: + except getopt.error as msg: print ('python groups_provisioning_quick_start_example.py' ' --client_id [clientId] --client_secret [clientSecret]' ' --domain [domain]') @@ -284,17 +284,17 @@ domain = arg while not client_id: - client_id = raw_input('Please enter a clientId: ') + client_id = input('Please enter a clientId: ') while not client_secret: - client_secret = raw_input('Please enter a clientSecret: ') + client_secret = input('Please enter a clientSecret: ') while not domain: - domain = raw_input('Please enter domain name (example.com): ') + domain = input('Please enter domain name (example.com): ') try: groups_quick_start_example = GroupsQuickStartExample( client_id, client_secret, domain) except gdata.service.BadAuthentication: - print 'Invalid user credentials given.' + print('Invalid user credentials given.') return groups_quick_start_example.CreateGroupsClient() --- ./samples/apps/emailsettings_example.py (original) +++ ./samples/apps/emailsettings_example.py (refactored) @@ -105,89 +105,89 @@ """ if setting == 'label': if method == 'get': - print "getting labels for %s...\n" % (username) - print self.client.RetrieveLabels(username=username) - elif method == 'set': - print "creating label for %s...\n" % (username) - print self.client.CreateLabel(username=username, name=LABEL_NAME) - else: - print "deleting labels isn't supported" + print("getting labels for %s...\n" % (username)) + print(self.client.RetrieveLabels(username=username)) + elif method == 'set': + print("creating label for %s...\n" % (username)) + print(self.client.CreateLabel(username=username, name=LABEL_NAME)) + else: + print("deleting labels isn't supported") elif setting == 'forwarding': if method == 'get': - print "getting forwarding for %s...\n" % (username) - print self.client.RetrieveForwarding(username) - elif method == 'set': - print "updating forwarding settings for %s...\n" % (username) - print self.client.UpdateForwarding(username=username, + print("getting forwarding for %s...\n" % (username)) + print(self.client.RetrieveForwarding(username)) + elif method == 'set': + print("updating forwarding settings for %s...\n" % (username)) + print(self.client.UpdateForwarding(username=username, enable=not(options.disable), forward_to=FORWARD_TO, - action=FORWARDING_ACTION) - else: - print "deleting forwarding settings isn't supported" + action=FORWARDING_ACTION)) + else: + print("deleting forwarding settings isn't supported") elif setting == 'sendas': if method == 'get': - print "getting sendAs alias for %s...\n" % (username) - print self.client.RetrieveSendAs(username=username) - elif method == 'set': - print "creating sendAs alias for %s...\n" % (username) - print self.client.CreateSendAs(username=username, name=SEND_AS_NAME, + print("getting sendAs alias for %s...\n" % (username)) + print(self.client.RetrieveSendAs(username=username)) + elif method == 'set': + print("creating sendAs alias for %s...\n" % (username)) + print(self.client.CreateSendAs(username=username, name=SEND_AS_NAME, address=SEND_AS_ADDRESS, reply_to=SEND_AS_REPLY_TO, - make_default=SEND_AS_MAKE_DEFAULT) - else: - print "deleting send-as settings isn't supported" + make_default=SEND_AS_MAKE_DEFAULT)) + else: + print("deleting send-as settings isn't supported") elif setting == 'pop': if method == 'get': - print "getting pop settings for %s...\n" % (username) - print self.client.RetrievePop(username=username) - elif method == 'set': - print "updating pop settings for %s...\n" % (username) - print self.client.UpdatePop(username=username, + print("getting pop settings for %s...\n" % (username)) + print(self.client.RetrievePop(username=username)) + elif method == 'set': + print("updating pop settings for %s...\n" % (username)) + print(self.client.UpdatePop(username=username, enable=not(options.disable), enable_for=POP_ENABLE_FOR, - action=POP_ACTION) - else: - print "deleting pop settings isn't supported" + action=POP_ACTION)) + else: + print("deleting pop settings isn't supported") elif setting == 'signature': if method == 'get': - print "getting signature for %s...\n" % (username) - print self.client.RetrieveSignature(username=username) - elif method == 'set': - print "updating signature for %s...\n" % (username) - print self.client.UpdateSignature(username=username, - signature=SIGNATURE) - else: - print "deleting signature settings isn't supported" + print("getting signature for %s...\n" % (username)) + print(self.client.RetrieveSignature(username=username)) + elif method == 'set': + print("updating signature for %s...\n" % (username)) + print(self.client.UpdateSignature(username=username, + signature=SIGNATURE)) + else: + print("deleting signature settings isn't supported") elif setting == 'vacation': if method == 'get': - print "getting vacation settings for %s...\n" % (username) - print self.client.RetrieveVacation(username=username) - elif method == 'set': - print "updating vacation settings for %s...\n" % (username) - print self.client.UpdateVacation(username=username, + print("getting vacation settings for %s...\n" % (username)) + print(self.client.RetrieveVacation(username=username)) + elif method == 'set': + print("updating vacation settings for %s...\n" % (username)) + print(self.client.UpdateVacation(username=username, enable=not(options.disable), subject=VACATION_SUBJECT, message=VACATION_MESSAGE, - contacts_only=VACATION_CONTACTS_ONLY) - else: - print "deleting vacation settings isn't supported" + contacts_only=VACATION_CONTACTS_ONLY)) + else: + print("deleting vacation settings isn't supported") elif setting == 'imap': if method == 'get': - print "getting imap settings for %s...\n" % (username) - print self.client.RetrieveImap(username) + print("getting imap settings for %s...\n" % (username)) + print(self.client.RetrieveImap(username)) elif setting == 'set': - print "updating imap settings for %s...\n" % (username) - print self.client.UpdateImap(username=username, - enable=not(options.disable)) - else: - print "deleting imap settings isn't supported" + print("updating imap settings for %s...\n" % (username)) + print(self.client.UpdateImap(username=username, + enable=not(options.disable))) + else: + print("deleting imap settings isn't supported") elif setting == 'filter': if method == 'get': - print "getting email filters is not yet possible\n" + print("getting email filters is not yet possible\n") parser.print_help() elif method == 'set': - print "creating an email filter for %s...\n" % (username) - print self.client.CreateFilter(username=username, + print("creating an email filter for %s...\n" % (username)) + print(self.client.CreateFilter(username=username, from_address=FILTER_FROM, to_address=FILTER_TO, subject=FILTER_SUBJECT, @@ -197,16 +197,16 @@ has_attachments=FILTER_HAS_ATTACHMENT, label=FILTER_LABEL, mark_as_read=FILTER_SHOULD_MARK_AS_READ, - archive=FILTER_SHOULD_ARCHIVE) - else: - print "deleting filters isn't supported" + archive=FILTER_SHOULD_ARCHIVE)) + else: + print("deleting filters isn't supported") elif setting == 'general': if method == 'get': - print "getting general email settings is not yet possible\n" + print("getting general email settings is not yet possible\n") parser.print_help() elif method == 'set': - print "updating general settings for %s...\n" % (username) - print self.client.UpdateGeneralSettings(username=username, + print("updating general settings for %s...\n" % (username)) + print(self.client.UpdateGeneralSettings(username=username, page_size=GENERAL_PAGE_SIZE, shortcuts= GENERAL_ENABLE_SHORTCUTS, @@ -215,41 +215,41 @@ snippets= GENERAL_ENABLE_SNIPPETS, use_unicode= - GENERAL_ENABLE_UNICODE) - else: - print "deleting general settings isn't supported" + GENERAL_ENABLE_UNICODE)) + else: + print("deleting general settings isn't supported") elif setting == 'language': if method == 'get': - print "getting language settings is not yet possible\n" + print("getting language settings is not yet possible\n") parser.print_help() elif method == 'set': - print "updating language for %s...\n" % (username) - print self.client.UpdateLanguage(username=username, language=LANGUAGE) - else: - print "deleting language settings isn't supported" + print("updating language for %s...\n" % (username)) + print(self.client.UpdateLanguage(username=username, language=LANGUAGE)) + else: + print("deleting language settings isn't supported") elif setting == 'webclip': if method == 'get': - print "getting webclip settings is not yet possible\n" + print("getting webclip settings is not yet possible\n") parser.print_help() elif method == 'get': - print "updating webclip settings for %s...\n" % (username) - print self.client.UpdateWebclip(username=username, - enable=not(options.disable)) - else: - print "deleting webclip settings isn't supported" + print("updating webclip settings for %s...\n" % (username)) + print(self.client.UpdateWebclip(username=username, + enable=not(options.disable))) + else: + print("deleting webclip settings isn't supported") elif setting == 'delegation': if method == 'get': - print "getting email delegates for %s..." % (username) - print self.client.RetrieveEmailDelegates(username=username) + print("getting email delegates for %s..." % (username)) + print(self.client.RetrieveEmailDelegates(username=username)) elif method == 'set': address = args['delegaRefactoringTool: Refactored ./samples/apps/email_settings_labels_filters.py tionId'] - print "adding %s as an email delegate to %s..." % (address, username) - print self.client.AddEmailDelegate(username=username, address=address) + print("adding %s as an email delegate to %s..." % (address, username)) + print(self.client.AddEmailDelegate(username=username, address=address)) else: address = args['delegationId'] - print "deleting %s as an email delegate for %s..." % (address, username) - print self.client.DeleteEmailDelegate(username=username, - address=address) + print("deleting %s as an email delegate for %s..." % (address, username)) + print(self.client.DeleteEmailDelegate(username=username, + address=address)) else: parser.print_help() --- ./samples/apps/email_settings_labels_filters.py (original) +++ ./samples/apps/email_settings_labels_filters.py (refactored) @@ -98,9 +98,9 @@ self.provisioning_client = gdata.apps.client.AppsClient(domain=self.domain) request_token = self.email_settings_client.GetOAuthToken( SCOPES, None, self.consumer_key, consumer_secret=self.consumer_secret) - print request_token.GenerateAuthorizationUrl() - - raw_input('Manually go to the above URL and authenticate.' + print(request_token.GenerateAuthorizationUrl()) + + input('Manually go to the above URL and authenticate.' 'Press Return after authorization.') access_token = self.email_settings_client.GetAccessToken(request_token) self.email_settings_client.auth_token = access_token @@ -140,7 +140,7 @@ self.email_settings_client.CreateFilter(username=username, has_the_word=tag, label=label_name) - except gdata.client.RequestError, e: + except gdata.client.RequestError as e: if e.status == 503 and tries < MAX_RETRIES: time.sleep(2 ^ tries + random.randint(0, 10)) self._CreateFestivalSettingsForUser(username, festival, tries+1) @@ -150,12 +150,12 @@ Asks application user for whom to create the festival wishes labels and filters. """ - print 'Whom would you like to create labels for?' + print('Whom would you like to create labels for?') print ('1 - For all user in the domain.' '(WARNING: May take a long time depending on your domain size.)') - print '2 - Single user' - - choice = raw_input('Enter your choice: ').strip() + print('2 - Single user') + + choice = input('Enter your choice: ').strip() if choice.isdigit(): choice = int(choice) @@ -164,12 +164,12 @@ for user in users.entry: self._CreateLabelsFiltersForUser(user.login.user_name) elif choice == 2: - username = raw_input('Enter a valid username: ') + username = input('Enter a valid username: ') self._CreateLabelsFiltersForUser(username) else: - print 'Invalid choice' + print('Invalid choice') return - print 'Labels and Filters created successfully' + print('Labels and Filters created successfully') def PrintUsageString(): @@ -186,7 +186,7 @@ opts, args = getopt.getopt(sys.argv[1:], '', ['consumer_key=', 'consumer_secret=', 'domain=']) - except getopt.error, msg: + except getopt.error as msg: PrintUsageString() sys.exit(1) @@ -202,7 +202,7 @@ domain = arg if not (consumer_key and consumer_secret and domain): - print 'Requires exactly three flags.' + print('Requires exactly three flags.') PrintUsageString() sys.exit(1) @@ -210,7 +210,7 @@ consumer_key, consumer_secret, domain) try: festival_wishes_labels.Authorize() - except gdata.client.RequestError, e: + except gdata.client.RequestError as e: if e.status == 400: raise FestivalSettingsException('Invalid consumer credentials') else: @@ -219,RefactoringTool: Refactored ./samples/apps/email_audit_email_monitoring.py 13 +219,13 @@ try: festival_wishes_labels.Run() - except gdata.client.RequestError, e: + except gdata.client.RequestError as e: if e.status == 403: raise FestivalSettingsException('Invalid Domain') elif e.status == 400: raise FestivalSettingsException('Invalid username') else: - print e.reason + print(e.reason) raise FestivalSettingsException('Unknown error') --- ./samples/apps/email_audit_email_monitoring.py (original) +++ ./samples/apps/email_audit_email_monitoring.py (refactored) @@ -59,8 +59,8 @@ request_token = self.service.FetchOAuthRequestToken() self.service.SetOAuthToken(request_token) auth_url = self.service.GenerateOAuthAuthorizationURL() - print auth_url - raw_input('Manually go to the above URL and authenticate.' + print(auth_url) + input('Manually go to the above URL and authenticate.' 'Press Return after authorization.') self.service.UpgradeToOAuthAccessToken() @@ -74,7 +74,7 @@ True if username is valid, False otherwise. """ if len(username) > 64: - print 'Username length should be less than 64' + print('Username length should be less than 64') return False pattern = re.compile('[^\w\.\+-_\']+') return not bool(pattern.search(username)) @@ -90,9 +90,9 @@ """ username = '' while not username: - username = raw_input('Enter a valid %s username: ' % typeof) + username = input('Enter a valid %s username: ' % typeof) if not self._CheckUsername(username): - print 'Invalid username' + print('Invalid username') username = '' return username @@ -110,7 +110,7 @@ if not is_neccessary: extra_stmt = '. Press enter to skip.' while not date: - date = raw_input( + date = input( 'Enter a valid date as (yyyy-mm-dd HH:MM)%s:' % extra_stmt) if not (date and is_neccessary): return date @@ -118,7 +118,7 @@ datetime.strptime(date, '%Y-%m-%d %H:%M') return date except ValueError: - print 'Not a valid date!' + print('Not a valid date!') date = '' def _GetBool(self, name): @@ -130,7 +130,7 @@ Returns: A boolean for an entity represented by name. """ - choice = raw_input( + choice = input( 'Enter your choice (t/f) for %s (defaults to False):' % name).strip() if choice == 't': return True @@ -158,24 +158,24 @@ incoming_headers, outgoing_headers, drafts, drafts_headers, chats, chats_headers) - print 'Email monitor created/updated successfully!\n' + print('Email monitor created/updated successfully!\n') def _RetrieveEmailMonitor(self): """Retrieves all email monitors for a user.""" src_user = self._GetValidUsername('source') monitors = self.service.getEmailMonitors(src_user) for monitor in monitors: - for key in monitor.keys(): - print '%s ----------- %s' % (key, monitor.get(key)) - print '' - print 'Email monitors retrieved successfully!\n' + for key in list(monitor.keys()): + print('%s ----------- %s' % (key, monitor.get(key))) + print('') + print('Email monitors retrieved successfully!\n') def _DeleteEmailMonitor(self): """Deletes an email monitor.""" src_user = self._GetValidUsername('source') dest_user = self._GetValidUsername('destination') self.service.deleteEmailMonitor(src_user, dest_user) - print 'Email monitor deleted successfully!\n' + print('Email monitor deleted successfully!\n') def Run(self): """Handles the flow of the sample.""" @@ -199,23 +199,23 @@ ] while True: - print 'What would you like to do? Choose an option:' - print '0 - To exit' + print('What would you like to do? Choose an option:') + print('0 - To exit') for i in range (0, len(functions_list)): - print '%d - %s' % ((i + 1), functions_list[i].get('description')) - choice = raw_input('Enter your choice: ').striRefactoringTool: Refactored ./samples/apps/create_update_group.py p() + print('%d - %s' % ((i + 1), functions_list[i].get('description'))) + choice = input('Enter your choice: ').strip() if choice.isdigit(): choice = int(choice) if choice == 0: break if choice < 0 or choice > len(functions_list): - print 'Not a valid option!' + print('Not a valid option!') continue try: functions_list[choice - 1].get('function')() - except gdata.apps.service.AppsForYourDomainException, e: + except gdata.apps.service.AppsForYourDomainException as e: if e.error_code == 1301: - print '\nError: Invalid username!!\n' + print('\nError: Invalid username!!\n') else: raise e @@ -234,7 +234,7 @@ opts, args = getopt.getopt(sys.argv[1:], '', ['consumer_key=', 'consumer_secret=', 'domain=']) - except getopt.error, msg: + except getopt.error as msg: PrintUsageString() sys.exit(1) @@ -250,7 +250,7 @@ domain = arg if not (consumer_key and consumer_secret and domain): - print 'Requires exactly three flags.' + print('Requires exactly three flags.') PrintUsageString() sys.exit(1) @@ -258,11 +258,11 @@ email_monitoring = EmailMonitoring( consumer_key, consumer_secret, domain) email_monitoring.Run() - except gdata.apps.service.AppsForYourDomainException, e: + except gdata.apps.service.AppsForYourDomainException as e: raise EmailMonitoringException('Invalid Domain') - except gdata.service.FetchingOAuthRequestTokenFailed, e: + except gdata.service.FetchingOAuthRequestTokenFailed as e: raise EmailMonitoringException('Invalid consumer credentials') - except Exception, e: + except Exception as e: if e.args[0].get('status') == 503: raise EmailMonitoringException('Server busy') elif e.args[0].get('status') == 500: --- ./samples/apps/create_update_group.py (original) +++ ./samples/apps/create_update_group.py (refactored) @@ -102,21 +102,21 @@ authorized group provisioning client domain: String domain name """ - group_id = raw_input('Enter the group id: ') - group_name = raw_input('Enter the group name: ') - group_description = raw_input('Enter the group description: ') - email_permission = raw_input('Enter the email permission: ') + group_id = input('Enter the group id: ') + group_name = input('Enter the group name: ') + group_description = input('Enter the group description: ') + email_permission = input('Enter the email permission: ') if not (group_id and group_name): - print 'One or more required fields missing: group id, group name' + print('One or more required fields missing: group id, group name') sys.exit(1) new_group = groups_client.CreateGroup(group_id=group_id, group_name=group_name, description=group_description, email_permission=email_permission) - print 'Group Created %s' % new_group.group_id - print 'Name: %s\nDescription %s\nEmail Permission %s' % ( - new_group.group_name, new_group.description, new_group.email_permission) + print('Group Created %s' % new_group.group_id) + print('Name: %s\nDescription %s\nEmail Permission %s' % ( + new_group.group_name, new_group.description, new_group.email_permission)) group_id = '%s@%s' % (new_group.group_id, domain) service = build('groupssettings', 'v1', http=http) @@ -128,7 +128,7 @@ 'whoCanViewMembership': 'ALL_IN_DOMAIN_CAN_VIEW'} # Update the group properties g = group_resource.update(groupUniqueId=group_id, body=body).execute() - print '\nUpdated Access Permissions to the group\n' + print('\nUpdated Access Permissions to the group\n') pprint.pprint(g) @@ -137,7 +137,7 @@ storage = Storage('group.dat') credentials = storage.get() if credentials is None or credentials.invalid: - print 'Credentials are invalid or do not exist.' + print('Credentials are invalid or do not exist.') credentials = rRefactoringTool: Refactored ./samples/apps/adminsettings_example.py un(FLOW, storage) # Create an httplib2.Http object to handle our HTTP requests and authorize it @@ -145,7 +145,7 @@ http = httplib2.Http() http = credentials.authorize(http) - domain = raw_input('Enter the domain: ') + domain = input('Enter the domain: ') # Create an OAuth 2.0 token suitable for use with the GData client library oauth2token = GetOAuth2Token(credentials.client_id, --- ./samples/apps/adminsettings_example.py (original) +++ ./samples/apps/adminsettings_example.py (refactored) @@ -54,66 +54,66 @@ def Run(self): #pause 1 sec inbetween calls to prevent quota warning - print 'Google Apps Domain: ', self.gd_client.domain + print('Google Apps Domain: ', self.gd_client.domain) time.sleep(1) - print 'Default Language: ', self.gd_client.GetDefaultLanguage() + print('Default Language: ', self.gd_client.GetDefaultLanguage()) time.sleep(1) - print 'Organization Name: ', self.gd_client.GetOrganizationName() + print('Organization Name: ', self.gd_client.GetOrganizationName()) time.sleep(1) - print 'Maximum Users: ', self.gd_client.GetMaximumNumberOfUsers() + print('Maximum Users: ', self.gd_client.GetMaximumNumberOfUsers()) time.sleep(1) - print 'Current Users: ', self.gd_client.GetCurrentNumberOfUsers() + print('Current Users: ', self.gd_client.GetCurrentNumberOfUsers()) time.sleep(1) - print 'Domain is Verified: ',self.gd_client.IsDomainVerified() + print('Domain is Verified: ',self.gd_client.IsDomainVerified()) time.sleep(1) - print 'Support PIN: ',self.gd_client.GetSupportPIN() + print('Support PIN: ',self.gd_client.GetSupportPIN()) time.sleep(1) - print 'Domain Edition: ', self.gd_client.GetEdition() + print('Domain Edition: ', self.gd_client.GetEdition()) time.sleep(1) - print 'Customer PIN: ', self.gd_client.GetCustomerPIN() + print('Customer PIN: ', self.gd_client.GetCustomerPIN()) time.sleep(1) - print 'Domain Creation Time: ', self.gd_client.GetCreationTime() + print('Domain Creation Time: ', self.gd_client.GetCreationTime()) time.sleep(1) - print 'Domain Country Code: ', self.gd_client.GetCountryCode() + print('Domain Country Code: ', self.gd_client.GetCountryCode()) time.sleep(1) - print 'Admin Secondary Email: ', self.gd_client.GetAdminSecondaryEmail() + print('Admin Secondary Email: ', self.gd_client.GetAdminSecondaryEmail()) time.sleep(1) cnameverificationstatus = self.gd_client.GetCNAMEVerificationStatus() - print 'CNAME Verification Record Name: ', cnameverificationstatus['recordName'] - print 'CNAME Verification Verified: ', cnameverificationstatus['verified'] - print 'CNAME Verification Method: ', cnameverificationstatus['verificationMethod'] + print('CNAME Verification Record Name: ', cnameverificationstatus['recordName']) + print('CNAME Verification Verified: ', cnameverificationstatus['verified']) + print('CNAME Verification Method: ', cnameverificationstatus['verificationMethod']) time.sleep(1) mxverificationstatus = self.gd_client.GetMXVerificationStatus() - print 'MX Verification Verified: ', mxverificationstatus['verified'] - print 'MX Verification Method: ', mxverificationstatus['verificationMethod'] + print('MX Verification Verified: ', mxverificationstatus['verified']) + print('MX Verification Method: ', mxverificationstatus['verificationMethod']) time.sleep(1) ssosettings = self.gd_client.GetSSOSettings() - print 'SSO Enabled: ', ssosettings['enableSSO'] - print 'SSO Signon Page: ', ssosettings['samlSignonUri'] - print 'SSO Logout Page: ', ssosettings['samlLogoutUri'] - print 'SSO Password Page: ', ssosettings['changePasswordUri'] - print 'SSO Whitelist IPs: ', ssosettings['ssoWhitelist'] - print 'SSO Use Domain Specific Issuer: ', ssosettings['useDomainSpecificIssuer'] + print('SSO Enabled: ', ssosettings['enableSSO']) + print('SSO Signon Page: ', ssosettings['samlSignonUri']) + print('SSO Logout Page: ', ssosettings['samlLogoutUri']) + print('SRefactoringTool: Refactored ./samples/analytics/mgmt_feed_demo.py SO Password Page: ', ssosettings['changePasswordUri']) + print('SSO Whitelist IPs: ', ssosettings['ssoWhitelist']) + print('SSO Use Domain Specific Issuer: ', ssosettings['useDomainSpecificIssuer']) time.sleep(1) ssokey = self.gd_client.GetSSOKey() - print 'SSO Key Modulus: ', ssokey['modulus'] - print 'SSO Key Exponent: ', ssokey['exponent'] - print 'SSO Key Algorithm: ', ssokey['algorithm'] - print 'SSO Key Format: ', ssokey['format'] - print 'User Migration Enabled: ', self.gd_client.IsUserMigrationEnabled() + print('SSO Key Modulus: ', ssokey['modulus']) + print('SSO Key Exponent: ', ssokey['exponent']) + print('SSO Key Algorithm: ', ssokey['algorithm']) + print('SSO Key Format: ', ssokey['format']) + print('User Migration Enabled: ', self.gd_client.IsUserMigrationEnabled()) time.sleep(1) outboundgatewaysettings = self.gd_client.GetOutboundGatewaySettings() - print 'Outbound Gateway Smart Host: ', outboundgatewaysettings['smartHost'] - print 'Outbound Gateway Mode: ', outboundgatewaysettings['smtpMode'] + print('Outbound Gateway Smart Host: ', outboundgatewaysettings['smartHost']) + print('Outbound Gateway Mode: ', outboundgatewaysettings['smtpMode']) def main(): """Demonstrates use of the Admin Settings API using the AdminSettingsSample object.""" # Parse command line options try: opts, args = getopt.getopt(sys.argv[1:], '', ['user=', 'pw=', 'domain=']) - except getopt.error, msg: - print 'python adminsettings_example.py --user [username] --pw [password]' - print ' --domain [domain]' + except getopt.error as msg: + print('python adminsettings_example.py --user [username] --pw [password]') + print(' --domain [domain]') sys.exit(2) user = '' @@ -130,19 +130,19 @@ domain = arg while not domain: - print 'NOTE: Please run these tests only with a test account.' - domain = raw_input('Please enter your apps domain: ') + print('NOTE: Please run these tests only with a test account.') + domain = input('Please enter your apps domain: ') while not user: - user = raw_input('Please enter a administrator account: ')+'@'+domain + user = input('Please enter a administrator account: ')+'@'+domain while not pw: pw = getpass.getpass('Please enter password: ') if not pw: - print 'Password cannot be blank.' + print('Password cannot be blank.') try: sample = AdminSettingsSample(user, pw, domain) except gdata.service.BadAuthentication: - print 'Invalid user credentials given.' + print('Invalid user credentials given.') return sample.Run() --- ./samples/analytics/mgmt_feed_demo.py (original) +++ ./samples/analytics/mgmt_feed_demo.py (refactored) @@ -107,15 +107,15 @@ account_query = gdata.analytics.client.AccountQuery() results = self.my_client.GetManagementFeed(account_query) - print '-------- Account Feed Data --------' - if not results.entry: - print 'no entries found' - else: - for entry in results.entry: - print 'Account Name = ' + entry.GetProperty('ga:accountName').value - print 'Account ID = ' + entry.GetProperty('ga:accountId').value - print 'Child Feed Link = ' + entry.GetChildLink('analytics#webproperties').href - print + print('-------- Account Feed Data --------') + if not results.entry: + print('no entries found') + else: + for entry in results.entry: + print('Account Name = ' + entry.GetProperty('ga:accountName').value) + print('Account ID = ' + entry.GetProperty('ga:accountId').value) + print('Child Feed Link = ' + entry.GetChildLink('analytics#webproperties').href) + print() def PrintWebPropertyFeed(self): """Requests and prints the important data in the Web Property Feed.""" @@ -124,15 +124,15 @@ acct_id=ACCOUNT_ID) results = self.my_client.GetManagementFeed(web_property_query) - print '-------- Web Property Feed Data --------' - if not results.entry: - print 'no entries found' - else: - for entry in results.entry: - print 'Account ID = ' + entry.GetProperty('ga:accountId').value - print 'Web Property ID = ' + entry.GetProperty('ga:webPropertyId').value - print 'Child Feed Link = ' + entry.GetChildLink('analytics#profiles').href - print + print('-------- Web Property Feed Data --------') + if not results.entry: + print('no entries found') + else: + for entry in results.entry: + print('Account ID = ' + entry.GetProperty('ga:accountId').value) + print('Web Property ID = ' + entry.GetProperty('ga:webPropertyId').value) + print('Child Feed Link = ' + entry.GetChildLink('analytics#profiles').href) + print() def PrintProfileFeed(self): """Requests and prints the important data in the Profile Feed. @@ -146,19 +146,19 @@ acct_id=ACCOUNT_ID, web_prop_id=WEB_PROPERTY_ID) results = self.my_client.GetManagementFeed(profile_query) - print '-------- Profile Feed Data --------' - if not results.entry: - print 'no entries found' - else: - for entry in results.entry: - print 'Account ID = ' + entry.GetProperty('ga:accountId').value - print 'Web Property ID = ' + entry.GetProperty('ga:webPropertyId').value - print 'Profile ID = ' + entry.GetProperty('ga:profileId').value - print 'Currency = ' + entry.GetProperty('ga:currency').value - print 'Timezone = ' + entry.GetProperty('ga:timezone').value - print 'TableId = ' + entry.GetProperty('dxp:tableId').value - print 'Child Feed Link = ' + entry.GetChildLink('analytics#goals').href - print + print('-------- Profile Feed Data --------') + if not results.entry: + print('no entries found') + else: + for entry in results.entry: + print('Account ID = ' + entry.GetProperty('ga:accountId').value) + print('Web Property ID = ' + entry.GetProperty('ga:webPropertyId').value) + print('Profile ID = ' + entry.GetProperty('ga:profileId').value) + print('Currency = ' + entry.GetProperty('ga:currency').value) + print('Timezone = ' + entry.GetProperty('ga:timezone').value) + print('TableId = ' + entry.GetProperty('dxp:tableId').value) + print('Child Feed Link = ' + entry.GetChildLink('analytics#goals').href) + print() def PrintGoalFeed(self): """Requests and prints the important data in the Goal Feed. @@ -172,15 +172,15 @@ acct_id=ACCOUNT_ID, web_prop_id=WEB_PROPERTY_ID, profile_id=PROFILE_ID) results = self.my_client.GetManagementFeed(goal_query) - print '-------- Goal Feed Data --------' - if not results.entry: - print 'no entries found' - else: - for entry in results.entry: - print 'Goal Number = ' + entry.goal.number - print 'Goal Name = ' + entry.goal.name - print 'Goal Value = ' + entry.goal.value - print 'Goal Active = ' + entry.goal.active + print('-------- Goal Feed Data --------') + if not results.entry: + print('no entries found') + else: + for entry in results.entry: + print('Goal Number = ' + entry.goal.number) + print('Goal Name = ' + entry.goal.name) + print('Goal Value = ' + entry.goal.value) + print('Goal Active = ' + entry.goal.active) if entry.goal.destination: self.PrintDestinationGoal(entry.goal.destination) @@ -195,19 +195,19 @@ destination: gdata.data.Destination The destination goal configuration. """ - print '\t----- Destination Goal -----' - print '\tExpression = ' + destination.expression - print '\tMatch Type = ' + destination.match_type - print '\tStep 1 Required = ' + destination.step1_required - print '\tCase Sensitive = ' + destination.case_sensitive + print('\t----- Destination Goal -----') + print('\tExpression = ' + destination.expression) + print('\tMatch Type = ' + destination.match_type) + print('\tStep 1 RequirRefactoringTool: Refactored ./samples/analytics/data_feed_demo.py ed = ' + destination.step1_required) + print('\tCase Sensitive = ' + destination.case_sensitive) if destination.step: - print '\t\t----- Destination Goal Steps -----' + print('\t\t----- Destination Goal Steps -----') for step in destination.step: - print '\t\tStep Number = ' + step.number - print '\t\tStep Name = ' + step.name - print '\t\tStep Path = ' + step.path - print + print('\t\tStep Number = ' + step.number) + print('\t\tStep Name = ' + step.name) + print('\t\tStep Path = ' + step.path) + print() def PrintEngagementGoal(self, engagement): """Prints the important information for engagement goals. @@ -216,11 +216,11 @@ engagement: gdata.data.Engagement The engagement goal configuration. """ - print '\t----- Engagement Goal -----' - print '\tGoal Type = ' + engagement.type - print '\tGoal Engagement = ' + engagement.comparison - print '\tGoal Threshold = ' + engagement.threshold_value - print + print('\t----- Engagement Goal -----') + print('\tGoal Type = ' + engagement.type) + print('\tGoal Engagement = ' + engagement.comparison) + print('\tGoal Threshold = ' + engagement.threshold_value) + print() def PrintSegmentFeed(self): """Requests and prints the important data in the Profile Feed.""" @@ -228,15 +228,15 @@ adv_seg_query = gdata.analytics.client.AdvSegQuery() results = self.my_client.GetManagementFeed(adv_seg_query) - print '-------- Advanced Segment Feed Data --------' - if not results.entry: - print 'no entries found' - else: - for entry in results.entry: - print 'Segment ID = ' + entry.segment.id - print 'Segment Name = ' + entry.segment.name - print 'Segment Definition = ' + entry.segment.definition.text - print + print('-------- Advanced Segment Feed Data --------') + if not results.entry: + print('no entries found') + else: + for entry in results.entry: + print('Segment ID = ' + entry.segment.id) + print('Segment Name = ' + entry.segment.name) + print('Segment Definition = ' + entry.segment.definition.text) + print() if __name__ == '__main__': main() --- ./samples/analytics/data_feed_demo.py (original) +++ ./samples/analytics/data_feed_demo.py (refactored) @@ -86,15 +86,15 @@ def PrintFeedDetails(self): """Prints important Analytics related data found at the top of the feed.""" - print '\n-------- Feed Data --------' - print 'Feed Title = ' + self.feed.title.text - print 'Feed Id = ' + self.feed.id.text - print 'Total Results Found = ' + self.feed.total_results.text - print 'Start Index = ' + self.feed.start_index.text - print 'Results Returned = ' + self.feed.items_per_page.text - print 'Start Date = ' + self.feed.start_date.text - print 'End Date = ' + self.feed.end_date.text - print 'Has Sampled Data = ' + str(self.feed.HasSampledData()) + print('\n-------- Feed Data --------') + print('Feed Title = ' + self.feed.title.text) + print('Feed Id = ' + self.feed.id.text) + print('Total Results Found = ' + self.feed.total_results.text) + print('Start Index = ' + self.feed.start_index.text) + print('Results Returned = ' + self.feed.items_per_page.text) + print('Start Date = ' + self.feed.start_date.text) + print('End Date = ' + self.feed.end_date.text) + print('Has Sampled Data = ' + str(self.feed.HasSampledData())) def PrintDataSources(self): """Prints data found in the data source elements. @@ -106,12 +106,12 @@ data_source = self.feed.data_source[0] - print '\n-------- Data Source Data --------' - print 'Table ID = ' + data_source.table_id.text - print 'Table Name = ' + data_source.table_name.text - print 'Web Property Id = ' + data_source.GetProperty('ga:webPropertyId').value - RefactoringTool: Refactored ./samples/analytics/account_feed_demo.py print 'Profile Id = ' + data_source.GetProperty('ga:profileId').value - print 'Account Name = ' + data_source.GetProperty('ga:accountName').value + print('\n-------- Data Source Data --------') + print('Table ID = ' + data_source.table_id.text) + print('Table Name = ' + data_source.table_name.text) + print('Web Property Id = ' + data_source.GetProperty('ga:webPropertyId').value) + print('Profile Id = ' + data_source.GetProperty('ga:profileId').value) + print('Account Name = ' + data_source.GetProperty('ga:accountName').value) def PrintFeedAggregates(self): """Prints data found in the aggregates elements. @@ -123,61 +123,61 @@ aggregates = self.feed.aggregates - print '\n-------- Metric Aggregates --------' + print('\n-------- Metric Aggregates --------') for met in aggregates.metric: - print '' - print 'Metric Name = ' + met.name - print 'Metric Value = ' + met.value - print 'Metric Type = ' + met.type - print 'Metric CI = ' + met.confidence_interval + print('') + print('Metric Name = ' + met.name) + print('Metric Value = ' + met.value) + print('Metric Type = ' + met.type) + print('Metric CI = ' + met.confidence_interval) def PrintSegmentInfo(self): """Prints segment information if the query has advanced segments defined.""" - print '-------- Advanced Segments Information --------' + print('-------- Advanced Segments Information --------') if self.feed.segment: if segment.name: - print 'Segment Name = ' + str(segment.name) + print('Segment Name = ' + str(segment.name)) if segment.id: - print 'Segment Id = ' + str(segment.id) - print 'Segment Definition = ' + segment.definition.text + print('Segment Id = ' + str(segment.id)) + print('Segment Definition = ' + segment.definition.text) else: - print 'No segments defined' + print('No segments defined') def PrintOneEntry(self): """Prints all the important Google Analytics data found in an entry""" - print '\n-------- One Entry --------' + print('\n-------- One Entry --------') if len(self.feed.entry) == 0: - print 'No entries found' + print('No entries found') return entry = self.feed.entry[0] - print 'ID = ' + entry.id.text + print('ID = ' + entry.id.text) for dim in entry.dimension: - print 'Dimension Name = ' + dim.name - print 'Dimension Value = ' + dim.value + print('Dimension Name = ' + dim.name) + print('Dimension Value = ' + dim.value) for met in entry.metric: - print 'Metric Name = ' + met.name - print 'Metric Value = ' + met.value - print 'Metric Type = ' + met.type - print 'Metric CI = ' + met.confidence_interval + print('Metric Name = ' + met.name) + print('Metric Value = ' + met.value) + print('Metric Type = ' + met.type) + print('Metric CI = ' + met.confidence_interval) def PrintFeedTable(self): """Prints all the entries as a table.""" - print '\n-------- All Entries In a Table --------' + print('\n-------- All Entries In a Table --------') for entry in self.feed.entry: for dim in entry.dimension: - print ('Dimension Name = %s \t Dimension Value = %s' - % (dim.name, dim.value)) + print(('Dimension Name = %s \t Dimension Value = %s' + % (dim.name, dim.value))) for met in entry.metric: - print ('Metric Name = %s \t Metric Value = %s' - % (met.name, met.value)) - print '---' + print(('Metric Name = %s \t Metric Value = %s' + % (met.name, met.value))) + print('---') if __name__ == '__main__': --- ./samples/analytics/account_feed_demo.py (original) +++ ./samples/analytics/account_feed_demo.py (refactored) @@ -71,56 +71,56 @@ def PrintFeedDetails(self): """Prints important Analytics related data found at the top of the feed.""" - print '-------- Important Feed Data --------' - print 'Feed Title = ' + self.feed.title.text - print 'Feed Id = ' + self.feed.id.text - print 'Total Results Found = ' + self.feed.total_results.text - print 'Start Index = ' + self.feed.start_index.text - print 'Results Returned = ' + self.feed.items_per_page.text + print('-------- Important Feed Data --------') + print('Feed Title = ' + self.feed.title.text) + print('Feed Id = ' + self.feed.id.text) + print('Total Results Found = ' + self.feed.total_results.text) + print('Start Index = ' + self.feed.start_index.text) + print('Results Returned = ' + self.feed.items_per_page.text) def PrintAdvancedSegments(self): """Prints the advanced segments for this user.""" - print '-------- Advances Segments --------' + print('-------- Advances Segments --------') if not self.feed.segment: - print 'No advanced segments found' + print('No advanced segments found') else: for segment in self.feed.segment: - print 'Segment Name = ' + segment.name - print 'Segment Id = ' + segment.id - print 'Segment Definition = ' + segment.definition.text + print('Segment Name = ' + segment.name) + print('Segment Id = ' + segment.id) + print('Segment Definition = ' + segment.definition.text) def PrintCustomVarForOneEntry(self): """Prints custom variable information for the first profile that has custom variable configured.""" - print '-------- Custom Variables --------' + print('-------- Custom Variables --------') if not self.feed.entry: - print 'No entries found' + print('No entries found') else: for entry in self.feed.entry: if entry.custom_variable: for custom_variable in entry.custom_variable: - print 'Custom Variable Index = ' + custom_variable.index - print 'Custom Variable Name = ' + custom_variable.name - print 'Custom Variable Scope = ' + custom_variable.scope + print('Custom Variable Index = ' + custom_variable.index) + print('Custom Variable Name = ' + custom_variable.name) + print('Custom Variable Scope = ' + custom_variable.scope) return - print 'No custom variables defined for this user' + print('No custom variables defined for this user') def PrintGoalsForOneEntry(self): """Prints All the goal information for one profile.""" - print '-------- Goal Configuration --------' + print('-------- Goal Configuration --------') if not self.feed.entry: - print 'No entries found' + print('No entries found') else: for entry in self.feed.entry: if entry.goal: for goal in entry.goal: - print 'Goal Number = ' + goal.number - print 'Goal Name = ' + goal.name - print 'Goal Value = ' + goal.value - print 'Goal Active = ' + goal.active + print('Goal Number = ' + goal.number) + print('Goal Name = ' + goal.name) + print('Goal Value = ' + goal.value) + print('Goal Active = ' + goal.active) if goal.destination: self.PrintDestinationGoal(goal.destination) @@ -136,19 +136,19 @@ destination: gdata.data.Destination The destination goal configuration. """ - print '----- Destination Goal -----' - print 'Expression = ' + destination.expression - print 'Match Type = ' + destination.match_type - print 'Step 1 Required = ' + destination.step1_required - print 'Case Sensitive = ' + destination.case_sensitive + print('----- Destination Goal -----') + print('Expression = ' + destination.expression) + print('Match Type = ' + destination.match_type) + print('Step 1 Required = ' + destination.step1_required) + print('Case Sensitive = ' + destination.case_sensitive) # PrintRefactoringTool: Files that were modified: RefactoringTool: ./upload-diffs.py RefactoringTool: ./tests/run_service_tests.py RefactoringTool: ./tests/run_data_tests.py RefactoringTool: ./tests/run_all_tests.py RefactoringTool: ./tests/module_test_runner.py RefactoringTool: ./tests/gdata_tests/youtube_test.py RefactoringTool: ./tests/gdata_tests/youtube/service_test.py RefactoringTool: ./tests/gdata_tests/youtube/live_client_test.py RefactoringTool: ./tests/gdata_tests/webmastertools_test.py RefactoringTool: ./tests/gdata_tests/spreadsheets/live_client_test.py RefactoringTool: ./tests/gdata_tests/spreadsheets/data_test.py RefactoringTool: ./tests/gdata_tests/spreadsheet_test.py RefactoringTool: ./tests/gdata_tests/spreadsheet/text_db_test.py RefactoringTool: ./tests/gdata_tests/spreadsheet/service_test.py RefactoringTool: ./tests/gdata_tests/sites/live_client_test.py RefactoringTool: ./tests/gdata_tests/sites/data_test.py RefactoringTool: ./tests/gdata_tests/service_test.py RefactoringTool: ./tests/gdata_tests/sample_util_test.py RefactoringTool: ./tests/gdata_tests/resumable_upload_test.py RefactoringTool: ./tests/gdata_tests/projecthosting/live_client_test.py RefactoringTool: ./tests/gdata_tests/projecthosting/data_test.py RefactoringTool: ./tests/gdata_tests/photos_test.py RefactoringTool: ./tests/gdata_tests/photos/service_test.py RefactoringTool: ./tests/gdata_tests/oauth/data_test.py RefactoringTool: ./tests/gdata_tests/marketplace/live_client_test.py RefactoringTool: ./tests/gdata_tests/live_client_test.py RefactoringTool: ./tests/gdata_tests/health_test.py RefactoringTool: ./tests/gdata_tests/health/service_test.py RefactoringTool: ./tests/gdata_tests/gauth_test.py RefactoringTool: ./tests/gdata_tests/docs_test.py RefactoringTool: ./tests/gdata_tests/docs/service_test.py RefactoringTool: ./tests/gdata_tests/docs/live_client_test.py RefactoringTool: ./tests/gdata_tests/docs/data_test.py RefactoringTool: ./tests/gdata_tests/data_test.py RefactoringTool: ./tests/gdata_tests/data_smoke_test.py RefactoringTool: ./tests/gdata_tests/core_test.py RefactoringTool: ./tests/gdata_tests/contentforshopping_test.py RefactoringTool: ./tests/gdata_tests/contacts_test.py RefactoringTool: ./tests/gdata_tests/contacts/service_test.py RefactoringTool: ./tests/gdata_tests/contacts/profiles/service_test.py RefactoringTool: ./tests/gdata_tests/contacts/profiles/live_client_test.py RefactoringTool: ./tests/gdata_tests/contacts/live_client_test.py RefactoringTool: ./tests/gdata_tests/codesearch_test.py RefactoringTool: ./tests/gdata_tests/client_test.py RefactoringTool: ./tests/gdata_tests/client_smoke_test.py RefactoringTool: ./tests/gdata_tests/calendar_test.py RefactoringTool: ./tests/gdata_tests/calendar_resource/live_client_test.py RefactoringTool: ./tests/gdata_tests/calendar_resource/data_test.py RefactoringTool: ./tests/gdata_tests/calendar/service_test.py RefactoringTool: ./tests/gdata_tests/calendar/calendar_acl_test.py RefactoringTool: ./tests/gdata_tests/books_test.py RefactoringTool: ./tests/gdata_tests/books/service_test.py RefactoringTool: ./tests/gdata_tests/blogger_test.py RefactoringTool: ./tests/gdata_tests/blogger/service_test.py RefactoringTool: ./tests/gdata_tests/blogger/live_client_test.py RefactoringTool: ./tests/gdata_tests/blogger/data_test.py RefactoringTool: ./tests/gdata_tests/auth_test.py RefactoringTool: ./tests/gdata_tests/apps_test.py RefactoringTool: ./tests/gdata_tests/apps/service_test_using_mock.py RefactoringTool: ./tests/gdata_tests/apps/service_test.py RefactoringTool: ./tests/gdata_tests/apps/organization/service_test.py RefactoringTool: ./tests/gdata_tests/apps/organization/live_client_test.py RefactoringTool: ./tests/gdata_tests/apps/organization/data_test.py RefactoringTool: ./tests/gdata_tests/apps/multidomain/live_client_test.py RefactoringTool: ./tests/gdata_tests/apps/multidomain/data_test.py RefactoringTool: ./tests/gdata_tests/apps/migration/service_test.py RefactoringTool: ./tests/gdata_tests/apps/live_client_test.py RefactoringTool: ./tests/gdata_tests/apps/groups/service_test.py RefactoringTool: ./tests/gdata_tests/apps/groups/live_client_test.py RefactoringTool: ./tests/gdata_tests/apps/groups/data_test.py RefactoringTool: ./tests/gdata_tests/apps/emailsettings/service_test.py RefactoringTool: ./tests/gdata_tests/apps/emailsettings/live_client_test.py RefactoringTool: ./tests/gdata_tests/apps/emailsettings/data_test.py RefactoringTool: ./tests/gdata_tests/apps/data_test.py RefactoringTool: ./tests/gdata_tests/analytics/query_test.py RefactoringTool: ./tests/gdata_tests/analytics/live_client_test.py RefactoringTool: ./tests/gdata_tests/analytics/data_test.py RefactoringTool: ./tests/gdata_test.py RefactoringTool: ./tests/coverage.py RefactoringTool: ./tests/atom_tests/url_test.py RefactoringTool: ./tests/atom_tests/token_store_test.py RefactoringTool: ./tests/atom_tests/service_test.py RefactoringTool: ./tests/atom_tests/mock_server_test.py RefactoringTool: ./tests/atom_tests/mock_http_test.py RefactoringTool: ./tests/atom_tests/mock_http_core_test.py RefactoringTool: ./tests/atom_tests/mock_client_test.py RefactoringTool: ./tests/atom_tests/http_interface_test.py RefactoringTool: ./tests/atom_tests/http_core_test.py RefactoringTool: ./tests/atom_tests/data_test.py RefactoringTool: ./tests/atom_tests/core_test.py RefactoringTool: ./tests/atom_tests/client_test.py RefactoringTool: ./tests/atom_tests/auth_test.py RefactoringTool: ./tests/atom_test.py RefactoringTool: ./tests/all_tests_local.py RefactoringTool: ./tests/all_tests_coverage.py RefactoringTool: ./tests/all_tests_clear_cache.py RefactoringTool: ./tests/all_tests_cached.py RefactoringTool: ./tests/all_tests.py RefactoringTool: ./src/gdata/youtube/service.py RefactoringTool: ./src/gdata/youtube/data.py RefactoringTool: ./src/gdata/youtube/client.py RefactoringTool: ./src/gdata/youtube/__init__.py RefactoringTool: ./src/gdata/webmastertools/service.py RefactoringTool: ./src/gdata/webmastertools/data.py RefactoringTool: ./src/gdata/webmastertools/__init__.py RefactoringTool: ./src/gdata/urlfetch.py RefactoringTool: ./src/gdata/test_data.py RefactoringTool: ./src/gdata/test_config.py RefactoringTool: ./src/gdata/spreadsheets/data.py RefactoringTool: ./src/gdata/spreadsheets/client.py RefactoringTool: ./src/gdata/spreadsheet/text_db.py RefactoringTool: ./src/gdata/spreadsheet/service.py RefactoringTool: ./src/gdata/spreadsheet/__init__.py RefactoringTool: ./src/gdata/sites/data.py RefactoringTool: ./src/gdata/sites/client.py RefactoringTool: ./src/gdata/service.py RefactoringTool: ./src/gdata/sample_util.py RefactoringTool: ./src/gdata/projecthosting/data.py RefactoringTool: ./src/gdata/projecthosting/client.py RefactoringTool: ./src/gdata/photos/service.py RefactoringTool: ./src/gdata/photos/__init__.py RefactoringTool: ./src/gdata/opensearch/data.py RefactoringTool: ./src/gdata/oauth/rsa.py RefactoringTool: ./src/gdata/oauth/__init__.py RefactoringTool: ./src/gdata/notebook/data.py RefactoringTool: ./src/gdata/media/data.py RefactoringTool: ./src/gdata/media/__init__.py RefactoringTool: ./src/gdata/marketplace/data.py RefactoringTool: ./src/gdata/marketplace/client.py RefactoringTool: ./src/gdata/health/service.py RefactoringTool: ./src/gdata/health/__init__.py RefactoringTool: ./src/gdata/geo/data.py RefactoringTool: ./src/gdata/geo/__init__.py RefactoringTool: ./src/gdata/gauth.py RefactoringTool: ./src/gdata/finance/service.py RefactoringTool: ./src/gdata/finance/data.py RefactoringTool: ./src/gdata/finance/__init__.py RefactoringTool: ./src/gdata/exif/__init__.py RefactoringTool: ./src/gdata/dublincore/data.py RefactoringTool: ./src/gdata/docs/service.py RefactoringTool: ./src/gdata/docs/data.py RefactoringTool: ./src/gdata/docs/client.py RefactoringTool: ./src/gdata/docs/__init__.py RefactoringTool: ./src/gdata/data.py RefactoringTool: ./src/gdata/core.py RefactoringTool: ./src/gdata/contentforshopping/data.py RefactoringTool: ./src/gdata/contentforshopping/client.py RefactoringTool: ./src/gdata/contentforshopping/__init__.py RefactoringTool: ./src/gdata/contacts/client.py RefactoringTool: ./src/gdata/contacts/service.py RefactoringTool: ./src/gdata/contacts/data.py RefactoringTool: ./src/gdata/contacts/__init__.py RefactoringTool: ./src/gdata/codesearch/service.py RefactoringTool: ./src/gdata/codesearch/__init__.py RefactoringTool: ./src/gdata/client.py RefactoringTool: ./src/gdata/calendar_resource/data.py RefactoringTool: ./src/gdata/calendar_resource/client.py RefactoringTool: ./src/gdata/calendar/service.py RefactoringTool: ./src/gdata/calendar/data.py RefactoringTool: ./src/gdata/calendar/client.py RefactoringTool: ./src/gdata/calendar/__init__.py RefactoringTool: ./src/gdata/books/service.py RefactoringTool: ./src/gdata/books/data.py RefactoringTool: ./src/gdata/books/__init__.py RefactoringTool: ./src/gdata/blogger/service.py RefactoringTool: ./src/gdata/blogger/data.py RefactoringTool: ./src/gdata/blogger/client.py RefactoringTool: ./src/gdata/blogger/__init__.py RefactoringTool: ./src/gdata/auth.py RefactoringTool: ./src/gdata/apps_property.py RefactoringTool: ./src/gdata/apps/service.py RefactoringTool: ./src/gdata/apps/organization/service.py RefactoringTool: ./src/gdata/apps/organization/data.py RefactoringTool: ./src/gdata/apps/organization/client.py RefactoringTool: ./src/gdata/apps/multidomain/data.py RefactoringTool: ./src/gdata/apps/multidomain/client.py RefactoringTool: ./src/gdata/apps/migration/service.py RefactoringTool: ./src/gdata/apps/migration/__init__.py RefactoringTool: ./src/gdata/apps/groups/service.py RefactoringTool: ./src/gdata/apps/groups/data.py RefactoringTool: ./src/gdata/apps/groups/client.py RefactoringTool: ./src/gdata/apps/emailsettings/service.py RefactoringTool: ./src/gdata/apps/emailsettings/data.py RefactoringTool: ./src/gdata/apps/emailsettings/client.py RefactoringTool: ./src/gdata/apps/data.py RefactoringTool: ./src/gdata/apps/client.py RefactoringTool: ./src/gdata/apps/audit/service.py RefactoringTool: ./src/gdata/apps/apps_property_entry.py RefactoringTool: ./src/gdata/apps/adminsettings/service.py RefactoringTool: ./src/gdata/apps/__init__.py RefactoringTool: ./src/gdata/analytics/service.py RefactoringTool: ./src/gdata/analytics/data.py RefactoringTool: ./src/gdata/analytics/client.py RefactoringTool: ./src/gdata/analytics/__init__.py RefactoringTool: ./src/gdata/alt/appengine.py RefactoringTool: ./src/gdata/alt/app_engine.py RefactoringTool: ./src/gdata/alt/__init__.py RefactoringTool: ./src/gdata/acl/data.py RefactoringTool: ./src/gdata/__init__.py RefactoringTool: ./src/atom/url.py RefactoringTool: ./src/atom/token_store.py RefactoringTool: ./src/atom/service.py RefactoringTool: ./src/atom/mock_service.py RefactoringTool: ./src/atom/mock_http_core.py RefactoringTool: ./src/atom/mock_http.py RefactoringTool: ./src/atom/http_interface.py RefactoringTool: ./src/atom/http_core.py RefactoringTool: ./src/atom/http.py RefactoringTool: ./src/atom/data.py RefactoringTool: ./src/atom/core.py RefactoringTool: ./src/atom/client.py RefactoringTool: ./src/atom/auth.py RefactoringTool: ./src/atom/__init__.py RefactoringTool: ./setup.py RefactoringTool: ./samples/webmastertools/SitesFeedSummary.py RefactoringTool: ./samples/webmastertools/SitemapsFeedSummary.py RefactoringTool: ./samples/webmastertools/AddDeleteExampleDotCom.py RefactoringTool: ./samples/spreadsheets/spreadsheetExample.py RefactoringTool: ./samples/sites/sites_example.py RefactoringTool: ./samples/oauth/oauth_on_appengine/main_rsa.py RefactoringTool: ./samples/oauth/oauth_on_appengine/main_hmac.py RefactoringTool: ./samples/oauth/oauth_on_appengine/appengine_utilities/sessions.py RefactoringTool: ./samples/oauth/oauth_on_appengine/appengine_utilities/rotmodel.py RefactoringTool: ./samples/oauth/oauth_on_appengine/appengine_utilities/paginator.py RefactoringTool: ./samples/oauth/oauth_on_appengine/appengine_utilities/flash.py RefactoringTool: ./samples/oauth/oauth_on_appengine/appengine_utilities/event.py RefactoringTool: ./samples/oauth/oauth_on_appengine/appengine_utilities/cron.py RefactoringTool: ./samples/oauth/oauth_on_appengine/appengine_utilities/cache.py RefactoringTool: ./samples/oauth/oauth_example.py RefactoringTool: ./samples/oauth/TwoLeggedOAuthExample.py RefactoringTool: ./samples/oauth/2_legged_oauth.py RefactoringTool: ./samples/mashups/birthdaySample.py RefactoringTool: ./samples/finance/test_finance.py RefactoringTool: ./samples/docs/samplerunner.py RefactoringTool: ./samples/docs/docs_v3_example.py RefactoringTool: ./samples/docs/docs_example.py RefactoringTool: ./samples/contentforshopping/list_products.py RefactoringTool: ./samples/contentforshopping/ca_list.py RefactoringTool: ./samples/contentforshopping/ca_insert.py RefactoringTool: ./samples/contentforshopping/add_product.py RefactoringTool: ./samples/contentforshopping/add_batch_products.py RefactoringTool: ./samples/contacts/unshare_profiles.py RefactoringTool: ./samples/contacts/profiles_example.py RefactoringTool: ./samples/contacts/contacts_example.py RefactoringTool: ./samples/codesearch/CodesearchExample.py RefactoringTool: ./samples/calendar_resource/calendar_resource_example.py RefactoringTool: ./samples/calendar/calendarExample.py RefactoringTool: ./samples/blogger/oauth-appengine/oauth.py RefactoringTool: ./samples/blogger/oauth-appengine/main.py RefactoringTool: ./samples/blogger/app/blogapp.py RefactoringTool: ./samples/blogger/BloggerExampleV1.py RefactoringTool: ./samples/blogger/BloggerExample.py RefactoringTool: ./samples/authsub/secure_authsub.py RefactoringTool: ./samples/apps/userprovisioning_quick_start_example.py RefactoringTool: ./samples/apps/user_profile_contacts_2lo.py RefactoringTool: ./samples/apps/suspended_users_cleanup.py RefactoringTool: ./samples/apps/search_organize_users.py RefactoringTool: ./samples/apps/provisioning_oauth_example/main.py RefactoringTool: ./samples/apps/provisioning_oauth2_example.py RefactoringTool: ./samples/apps/orgunit_quick_start_example.py RefactoringTool: ./samples/apps/org_unit_sites.py RefactoringTool: ./samples/apps/multidomain_quick_start_example.py RefactoringTool: ./samples/apps/migration_example.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/urlfetch.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/test_data.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/test_config.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/service.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/sample_util.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/oauth/rsa.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/oauth/__init__.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/gauth.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/data.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/core.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/client.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/calendar/service.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/calendar/data.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/calendar/client.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/calendar/__init__.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/auth.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/apps_property.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/apps/service.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/apps/organization/service.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/apps/organization/data.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/apps/organization/client.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/apps/multidomain/data.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/apps/multidomain/client.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/apps/migration/service.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/apps/migration/__init__.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/apps/groups/service.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/apps/groups/data.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/apps/groups/client.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/apps/emailsettings/service.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/apps/emailsettings/data.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/apps/emailsettings/client.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/apps/data.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/apps/client.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/apps/audit/service.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/apps/apps_property_entry.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/apps/adminsettings/service.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/apps/__init__.py RefactoringTool: ./samples/apps/marketplace_sample/gdata/__init__.py RefactoringTool: ./samples/apps/marketplace_sample/domain_mgmt_app.py RefactoringTool: ./samples/apps/marketplace_sample/atom/url.py RefactoringTool: ./samples/apps/marketplace_sample/atom/token_store.py RefactoringTool: ./samples/apps/marketplace_sample/atom/service.py RefactoringTool: ./samples/apps/marketplace_sample/atom/mock_service.py RefactoringTool: ./samples/apps/marketplace_sample/atom/mock_http_core.py RefactoringTool: ./samples/apps/marketplace_sample/atom/mock_http.py RefactoringTool: ./samples/apps/marketplace_sample/atom/http_interface.py RefactoringTool: ./samples/apps/marketplace_sample/atom/http_core.py RefactoringTool: ./samples/apps/marketplace_sample/atom/http.py RefactoringTool: ./samples/apps/marketplace_sample/atom/data.py RefactoringTool: ./samples/apps/marketplace_sample/atom/core.py RefactoringTool: ./samples/apps/marketplace_sample/atom/client.py RefactoringTool: ./samples/apps/marketplace_sample/atom/auth.py RefactoringTool: ./samples/apps/marketplace_sample/atom/__init__.py RefactoringTool: ./samples/apps/marketplace_sample/appengine_utilities/settings_default.py RefactoringTool: ./samples/apps/marketplace_sample/appengine_utilities/sessions.py RefactoringTool: ./samples/apps/marketplace_sample/appengine_utilities/rotmodel.py RefactoringTool: ./samples/apps/marketplace_sample/appengine_utilities/interface/main.py RefactoringTool: ./samples/apps/marketplace_sample/appengine_utilities/flash.py RefactoringTool: ./samples/apps/marketplace_sample/appengine_utilities/event.py RefactoringTool: ./samples/apps/marketplace_sample/appengine_utilities/django-middleware/middleware.py RefactoringTool: ./samples/apps/marketplace_sample/appengine_utilities/cache.py RefactoringTool: ./samples/apps/list_group_members.py RefactoringTool: ./samples/apps/groups_provisioning_quick_start_example.py RefactoringTool: ./samples/apps/emailsettings_example.py RefactoringTool: ./samples/apps/email_settings_labels_filters.py RefactoringTool: ./samples/apps/email_audit_email_monitoring.py RefactoringTool: ./samples/apps/create_update_group.py RefactoringTool: ./samples/apps/adminsettings_example.py RefactoringTool: ./samples/analytics/mgmt_feed_demo.py RefactoringTool: ./samples/analytics/data_feed_demo.py RefactoringTool: ./samples/analytics/account_feed_demo.py goal steps. if destination.step: - print '----- Destination Goal Steps -----' + print('----- Destination Goal Steps -----') for step in destination.step: - print 'Step Number = ' + step.number - print 'Step Name = ' + step.name - print 'Step Path = ' + step.path + print('Step Number = ' + step.number) + print('Step Name = ' + step.name) + print('Step Path = ' + step.path) def PrintEngagementGoal(self, engagement): """Prints the important information for engagement goals. @@ -157,31 +157,31 @@ engagement: gdata.data.Engagement The engagement goal configuration. """ - print '----- Engagement Goal -----' - print 'Goal Type = ' + engagement.type - print 'Goal Engagement = ' + engagement.comparison - print 'Goal Threshold = ' + engagement.threshold_value + print('----- Engagement Goal -----') + print('Goal Type = ' + engagement.type) + print('Goal Engagement = ' + engagement.comparison) + print('Goal Threshold = ' + engagement.threshold_value) def PrintAccountEntries(self): """Prints important Analytics data found in each account entry""" - print '-------- First 1000 Profiles in Account Feed --------' + print('-------- First 1000 Profiles in Account Feed --------') if not self.feed.entry: - print 'No entries found' + print('No entries found') else: for entry in self.feed.entry: - print 'Web Property ID = ' + entry.GetProperty('ga:webPropertyId').value - print 'Account Name = ' + entry.GetProperty('ga:accountName').value - print 'Account Id = ' + entry.GetProperty('ga:accountId').value - print 'Profile Name = ' + entry.title.text - print 'Profile ID = ' + entry.GetProperty('ga:profileId').value - print 'Table ID = ' + entry.table_id.text - print 'Currency = ' + entry.GetProperty('ga:currency').value - print 'TimeZone = ' + entry.GetProperty('ga:timezone').value + print('Web Property ID = ' + entry.GetProperty('ga:webPropertyId').value) + print('Account Name = ' + entry.GetProperty('ga:accountName').value) + print('Account Id = ' + entry.GetProperty('ga:accountId').value) + print('Profile Name = ' + entry.title.text) + print('Profile ID = ' + entry.GetProperty('ga:profileId').value) + print('Table ID = ' + entry.table_id.text) + print('Currency = ' + entry.GetProperty('ga:currency').value) + print('TimeZone = ' + entry.GetProperty('ga:timezone').value) if entry.custom_variable: - print 'This profile has custom variables' + print('This profile has custom variables') if entry.goal: - print 'This profile has goals' + print('This profile has goals') if __name__ == '__main__': + exit 0 Executing(%build): /bin/sh -e /usr/src/tmp/rpm-tmp.45444 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd python3-module-gdata-2.0.18 + CFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -march=i586 -mtune=generic' + export CFLAGS + CXXFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -march=i586 -mtune=generic' + export CXXFLAGS + FFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -march=i586 -mtune=generic' + export FFLAGS + /usr/bin/python3 setup.py build running build running build_py creating build creating build/lib creating build/lib/atom copying src/atom/url.py -> build/lib/atom copying src/atom/token_store.py -> build/lib/atom copying src/atom/service.py -> build/lib/atom copying src/atom/mock_service.py -> build/lib/atom copying src/atom/mock_http_core.py -> build/lib/atom copying src/atom/mock_http.py -> build/lib/atom copying src/atom/http_interface.py -> build/lib/atom copying src/atom/http_core.py -> build/lib/atom copying src/atom/http.py -> build/lib/atom copying src/atom/data.py -> build/lib/atom copying src/atom/core.py -> build/lib/atom copying src/atom/client.py -> build/lib/atom copying src/atom/auth.py -> build/lib/atom copying src/atom/__init__.py -> build/lib/atom creating build/lib/gdata copying src/gdata/urlfetch.py -> build/lib/gdata copying src/gdata/test_data.py -> build/lib/gdata copying src/gdata/test_config.py -> build/lib/gdata copying src/gdata/service.py -> build/lib/gdata copying src/gdata/sample_util.py -> build/lib/gdata copying src/gdata/gauth.py -> build/lib/gdata copying src/gdata/data.py -> build/lib/gdata copying src/gdata/core.py -> build/lib/gdata copying src/gdata/client.py -> build/lib/gdata copying src/gdata/auth.py -> build/lib/gdata copying src/gdata/apps_property.py -> build/lib/gdata copying src/gdata/__init__.py -> build/lib/gdata creating build/lib/gdata/acl copying src/gdata/acl/data.py -> build/lib/gdata/acl copying src/gdata/acl/__init__.py -> build/lib/gdata/acl creating build/lib/gdata/alt copying src/gdata/alt/appengine.py -> build/lib/gdata/alt copying src/gdata/alt/app_engine.py -> build/lib/gdata/alt copying src/gdata/alt/__init__.py -> build/lib/gdata/alt creating build/lib/gdata/analytics copying src/gdata/analytics/service.py -> build/lib/gdata/analytics copying src/gdata/analytics/data.py -> build/lib/gdata/analytics copying src/gdata/analytics/client.py -> build/lib/gdata/analytics copying src/gdata/analytics/__init__.py -> build/lib/gdata/analytics creating build/lib/gdata/apps copying src/gdata/apps/service.py -> build/lib/gdata/apps copying src/gdata/apps/data.py -> build/lib/gdata/apps copying src/gdata/apps/client.py -> build/lib/gdata/apps copying src/gdata/apps/apps_property_entry.py -> build/lib/gdata/apps copying src/gdata/apps/__init__.py -> build/lib/gdata/apps creating build/lib/gdata/apps/adminsettings copying src/gdata/apps/adminsettings/service.py -> build/lib/gdata/apps/adminsettings copying src/gdata/apps/adminsettings/__init__.py -> build/lib/gdata/apps/adminsettings creating build/lib/gdata/apps/audit copying src/gdata/apps/audit/service.py -> build/lib/gdata/apps/audit copying src/gdata/apps/audit/__init__.py -> build/lib/gdata/apps/audit creating build/lib/gdata/apps/emailsettings copying src/gdata/apps/emailsettings/service.py -> build/lib/gdata/apps/emailsettings copying src/gdata/apps/emailsettings/data.py -> build/lib/gdata/apps/emailsettings copying src/gdata/apps/emailsettings/client.py -> build/lib/gdata/apps/emailsettings copying src/gdata/apps/emailsettings/__init__.py -> build/lib/gdata/apps/emailsettings creating build/lib/gdata/apps/groups copying src/gdata/apps/groups/service.py -> build/lib/gdata/apps/groups copying src/gdata/apps/groups/data.py -> build/lib/gdata/apps/groups copying src/gdata/apps/groups/client.py -> build/lib/gdata/apps/groups copying src/gdata/apps/groups/__init__.py -> build/lib/gdata/apps/groups creating build/lib/gdata/apps/migration copying src/gdata/apps/migration/service.py -> build/lib/gdata/apps/migration copying src/gdata/apps/migration/__init__.py -> build/lib/gdata/apps/migration creating build/lib/gdata/apps/multidomain copying src/gdata/apps/multidomain/data.py -> build/lib/gdata/apps/multidomain copying src/gdata/apps/multidomain/client.py -> build/lib/gdata/apps/multidomain copying src/gdata/apps/multidomain/__init__.py -> build/lib/gdata/apps/multidomain creating build/lib/gdata/apps/organization copying src/gdata/apps/organization/service.py -> build/lib/gdata/apps/organization copying src/gdata/apps/organization/data.py -> build/lib/gdata/apps/organization copying src/gdata/apps/organization/client.py -> build/lib/gdata/apps/organization copying src/gdata/apps/organization/__init__.py -> build/lib/gdata/apps/organization creating build/lib/gdata/blogger copying src/gdata/blogger/service.py -> build/lib/gdata/blogger copying src/gdata/blogger/data.py -> build/lib/gdata/blogger copying src/gdata/blogger/client.py -> build/lib/gdata/blogger copying src/gdata/blogger/__init__.py -> build/lib/gdata/blogger creating build/lib/gdata/calendar copying src/gdata/calendar/service.py -> build/lib/gdata/calendar copying src/gdata/calendar/data.py -> build/lib/gdata/calendar copying src/gdata/calendar/client.py -> build/lib/gdata/calendar copying src/gdata/calendar/__init__.py -> build/lib/gdata/calendar creating build/lib/gdata/calendar_resource copying src/gdata/calendar_resource/data.py -> build/lib/gdata/calendar_resource copying src/gdata/calendar_resource/client.py -> build/lib/gdata/calendar_resource copying src/gdata/calendar_resource/__init__.py -> build/lib/gdata/calendar_resource creating build/lib/gdata/codesearch copying src/gdata/codesearch/service.py -> build/lib/gdata/codesearch copying src/gdata/codesearch/__init__.py -> build/lib/gdata/codesearch creating build/lib/gdata/contacts copying src/gdata/contacts/client.py -> build/lib/gdata/contacts copying src/gdata/contacts/service.py -> build/lib/gdata/contacts copying src/gdata/contacts/data.py -> build/lib/gdata/contacts copying src/gdata/contacts/__init__.py -> build/lib/gdata/contacts creating build/lib/gdata/contentforshopping copying src/gdata/contentforshopping/data.py -> build/lib/gdata/contentforshopping copying src/gdata/contentforshopping/client.py -> build/lib/gdata/contentforshopping copying src/gdata/contentforshopping/__init__.py -> build/lib/gdata/contentforshopping creating build/lib/gdata/docs copying src/gdata/docs/service.py -> build/lib/gdata/docs copying src/gdata/docs/data.py -> build/lib/gdata/docs copying src/gdata/docs/client.py -> build/lib/gdata/docs copying src/gdata/docs/__init__.py -> build/lib/gdata/docs creating build/lib/gdata/dublincore copying src/gdata/dublincore/data.py -> build/lib/gdata/dublincore copying src/gdata/dublincore/__init__.py -> build/lib/gdata/dublincore creating build/lib/gdata/exif copying src/gdata/exif/__init__.py -> build/lib/gdata/exif creating build/lib/gdata/geo copying src/gdata/geo/data.py -> build/lib/gdata/geo copying src/gdata/geo/__init__.py -> build/lib/gdata/geo creating build/lib/gdata/media copying src/gdata/media/data.py -> build/lib/gdata/media copying src/gdata/media/__init__.py -> build/lib/gdata/media creating build/lib/gdata/oauth copying src/gdata/oauth/rsa.py -> build/lib/gdata/oauth copying src/gdata/oauth/__init__.py -> build/lib/gdata/oauth creating build/lib/gdata/opensearch copying src/gdata/opensearch/data.py -> build/lib/gdata/opensearch copying src/gdata/opensearch/__init__.py -> build/lib/gdata/opensearch creating build/lib/gdata/photos copying src/gdata/photos/service.py -> build/lib/gdata/photos copying src/gdata/photos/__init__.py -> build/lib/gdata/photos creating build/lib/gdata/projecthosting copying src/gdata/projecthosting/data.py -> build/lib/gdata/projecthosting copying src/gdata/projecthosting/client.py -> build/lib/gdata/projecthosting copying src/gdata/projecthosting/__init__.py -> build/lib/gdata/projecthosting creating build/lib/gdata/sites copying src/gdata/sites/data.py -> build/lib/gdata/sites copying src/gdata/sites/client.py -> build/lib/gdata/sites copying src/gdata/sites/__init__.py -> build/lib/gdata/sites creating build/lib/gdata/spreadsheet copying src/gdata/spreadsheet/text_db.py -> build/lib/gdata/spreadsheet copying src/gdata/spreadsheet/service.py -> build/lib/gdata/spreadsheet copying src/gdata/spreadsheet/__init__.py -> build/lib/gdata/spreadsheet creating build/lib/gdata/spreadsheets copying src/gdata/spreadsheets/data.py -> build/lib/gdata/spreadsheets copying src/gdata/spreadsheets/client.py -> build/lib/gdata/spreadsheets copying src/gdata/spreadsheets/__init__.py -> build/lib/gdata/spreadsheets creating build/lib/gdata/webmastertools copying src/gdata/webmastertools/service.py -> build/lib/gdata/webmastertools copying src/gdata/webmastertools/data.py -> build/lib/gdata/webmastertools copying src/gdata/webmastertools/__init__.py -> build/lib/gdata/webmastertools creating build/lib/gdata/youtube copying src/gdata/youtube/service.py -> build/lib/gdata/youtube copying src/gdata/youtube/data.py -> build/lib/gdata/youtube copying src/gdata/youtube/client.py -> build/lib/gdata/youtube copying src/gdata/youtube/__init__.py -> build/lib/gdata/youtube /usr/lib/python3.8/distutils/dist.py:274: UserWarning: Unknown distribution option: 'install_requires' warnings.warn(msg) + chmod -x samples/analytics/account_feed_demo.py samples/analytics/data_feed_demo.py samples/analytics/mgmt_feed_demo.py samples/apps/adminsettings_example.py samples/apps/create_update_group.py samples/apps/email_audit_email_monitoring.py samples/apps/email_settings_labels_filters.py samples/apps/emailsettings_example.py samples/apps/groups_provisioning_quick_start_example.py samples/apps/list_group_members.py samples/apps/migration_example.py samples/apps/multidomain_quick_start_example.py samples/apps/org_unit_sites.py samples/apps/orgunit_quick_start_example.py samples/apps/provisioning_oauth2_example.py samples/apps/search_organize_users.py samples/apps/suspended_users_cleanup.py samples/apps/user_profile_contacts_2lo.py samples/apps/userprovisioning_quick_start_example.py samples/authsub/secure_authsub.py samples/blogger/BloggerExample.py samples/blogger/BloggerExampleV1.py samples/calendar/calendarExample.py samples/calendar_resource/calendar_resource_example.py samples/codesearch/CodesearchExample.py samples/contacts/contacts_example.py samples/contacts/profiles_example.py samples/contacts/unshare_profiles.py samples/contentforshopping/add_batch_products.py samples/contentforshopping/add_product.py samples/contentforshopping/ca_insert.py samples/contentforshopping/ca_list.py samples/contentforshopping/list_products.py samples/docs/docs_example.py samples/docs/docs_v3_example.py samples/docs/samplerunner.py samples/finance/test_finance.py samples/mashups/birthdaySample.py samples/oauth/2_legged_oauth.py samples/oauth/TwoLeggedOAuthExample.py samples/oauth/oauth_example.py samples/sites/sites_example.py samples/spreadsheets/spreadsheetExample.py samples/webmastertools/AddDeleteExampleDotCom.py samples/webmastertools/SitemapsFeedSummary.py samples/webmastertools/SitesFeedSummary.py + rm -rf src/gdata/Crypto/test.py + rm -rf src/gdata/Crypto/Util/test.py + exit 0 Executing(%install): /bin/sh -e /usr/src/tmp/rpm-tmp.58626 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + /bin/chmod -Rf u+rwX -- /usr/src/tmp/python3-module-gdata-buildroot + : + /bin/rm -rf -- /usr/src/tmp/python3-module-gdata-buildroot + cd python3-module-gdata-2.0.18 + CFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -march=i586 -mtune=generic' + export CFLAGS + CXXFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -march=i586 -mtune=generic' + export CXXFLAGS + FFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -march=i586 -mtune=generic' + export FFLAGS + /usr/bin/python3 setup.py install --skip-build --root=/usr/src/tmp/python3-module-gdata-buildroot --force running install running install_lib creating /usr/src/tmp/python3-module-gdata-buildroot creating /usr/src/tmp/python3-module-gdata-buildroot/usr creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3 creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube copying build/lib/gdata/youtube/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube copying build/lib/gdata/youtube/client.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube copying build/lib/gdata/youtube/data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube copying build/lib/gdata/youtube/service.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools copying build/lib/gdata/webmastertools/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools copying build/lib/gdata/webmastertools/data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools copying build/lib/gdata/webmastertools/service.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheets copying build/lib/gdata/spreadsheets/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheets copying build/lib/gdata/spreadsheets/client.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheets copying build/lib/gdata/spreadsheets/data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheets creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheet copying build/lib/gdata/spreadsheet/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheet copying build/lib/gdata/spreadsheet/service.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheet copying build/lib/gdata/spreadsheet/text_db.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheet creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sites copying build/lib/gdata/sites/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sites copying build/lib/gdata/sites/client.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sites copying build/lib/gdata/sites/data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sites creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/projecthosting copying build/lib/gdata/projecthosting/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/projecthosting copying build/lib/gdata/projecthosting/client.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/projecthosting copying build/lib/gdata/projecthosting/data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/projecthosting creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/photos copying build/lib/gdata/photos/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/photos copying build/lib/gdata/photos/service.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/photos creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/opensearch copying build/lib/gdata/opensearch/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/opensearch copying build/lib/gdata/opensearch/data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/opensearch creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/oauth copying build/lib/gdata/oauth/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/oauth copying build/lib/gdata/oauth/rsa.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/oauth creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/media copying build/lib/gdata/media/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/media copying build/lib/gdata/media/data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/media creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/geo copying build/lib/gdata/geo/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/geo copying build/lib/gdata/geo/data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/geo creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/exif copying build/lib/gdata/exif/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/exif creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/dublincore copying build/lib/gdata/dublincore/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/dublincore copying build/lib/gdata/dublincore/data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/dublincore creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs copying build/lib/gdata/docs/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs copying build/lib/gdata/docs/client.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs copying build/lib/gdata/docs/data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs copying build/lib/gdata/docs/service.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contentforshopping copying build/lib/gdata/contentforshopping/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contentforshopping copying build/lib/gdata/contentforshopping/client.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contentforshopping copying build/lib/gdata/contentforshopping/data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contentforshopping creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts copying build/lib/gdata/contacts/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts copying build/lib/gdata/contacts/data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts copying build/lib/gdata/contacts/service.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts copying build/lib/gdata/contacts/client.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/codesearch copying build/lib/gdata/codesearch/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/codesearch copying build/lib/gdata/codesearch/service.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/codesearch creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar_resource copying build/lib/gdata/calendar_resource/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar_resource copying build/lib/gdata/calendar_resource/client.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar_resource copying build/lib/gdata/calendar_resource/data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar_resource creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar copying build/lib/gdata/calendar/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar copying build/lib/gdata/calendar/client.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar copying build/lib/gdata/calendar/data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar copying build/lib/gdata/calendar/service.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger copying build/lib/gdata/blogger/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger copying build/lib/gdata/blogger/client.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger copying build/lib/gdata/blogger/data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger copying build/lib/gdata/blogger/service.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization copying build/lib/gdata/apps/organization/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization copying build/lib/gdata/apps/organization/client.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization copying build/lib/gdata/apps/organization/data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization copying build/lib/gdata/apps/organization/service.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/multidomain copying build/lib/gdata/apps/multidomain/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/multidomain copying build/lib/gdata/apps/multidomain/client.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/multidomain copying build/lib/gdata/apps/multidomain/data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/multidomain creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/migration copying build/lib/gdata/apps/migration/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/migration copying build/lib/gdata/apps/migration/service.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/migration creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups copying build/lib/gdata/apps/groups/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups copying build/lib/gdata/apps/groups/client.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups copying build/lib/gdata/apps/groups/data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups copying build/lib/gdata/apps/groups/service.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings copying build/lib/gdata/apps/emailsettings/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings copying build/lib/gdata/apps/emailsettings/client.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings copying build/lib/gdata/apps/emailsettings/data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings copying build/lib/gdata/apps/emailsettings/service.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/audit copying build/lib/gdata/apps/audit/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/audit copying build/lib/gdata/apps/audit/service.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/audit creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/adminsettings copying build/lib/gdata/apps/adminsettings/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/adminsettings copying build/lib/gdata/apps/adminsettings/service.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/adminsettings copying build/lib/gdata/apps/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps copying build/lib/gdata/apps/apps_property_entry.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps copying build/lib/gdata/apps/client.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps copying build/lib/gdata/apps/data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps copying build/lib/gdata/apps/service.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics copying build/lib/gdata/analytics/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics copying build/lib/gdata/analytics/client.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics copying build/lib/gdata/analytics/data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics copying build/lib/gdata/analytics/service.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt copying build/lib/gdata/alt/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt copying build/lib/gdata/alt/app_engine.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt copying build/lib/gdata/alt/appengine.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/acl copying build/lib/gdata/acl/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/acl copying build/lib/gdata/acl/data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/acl copying build/lib/gdata/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata copying build/lib/gdata/apps_property.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata copying build/lib/gdata/auth.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata copying build/lib/gdata/client.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata copying build/lib/gdata/core.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata copying build/lib/gdata/data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata copying build/lib/gdata/gauth.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata copying build/lib/gdata/sample_util.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata copying build/lib/gdata/service.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata copying build/lib/gdata/test_config.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata copying build/lib/gdata/test_data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata copying build/lib/gdata/urlfetch.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata creating /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom copying build/lib/atom/__init__.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom copying build/lib/atom/auth.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom copying build/lib/atom/client.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom copying build/lib/atom/core.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom copying build/lib/atom/data.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom copying build/lib/atom/http.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom copying build/lib/atom/http_core.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom copying build/lib/atom/http_interface.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom copying build/lib/atom/mock_http.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom copying build/lib/atom/mock_http_core.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom copying build/lib/atom/mock_service.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom copying build/lib/atom/service.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom copying build/lib/atom/token_store.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom copying build/lib/atom/url.py -> /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/client.py to client.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/data.py to data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/service.py to service.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools/data.py to data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools/service.py to service.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheets/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheets/client.py to client.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheets/data.py to data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheet/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheet/service.py to service.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheet/text_db.py to text_db.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sites/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sites/client.py to client.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sites/data.py to data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/projecthosting/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/projecthosting/client.py to client.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/projecthosting/data.py to data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/photos/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/photos/service.py to service.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/opensearch/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/opensearch/data.py to data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/oauth/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/oauth/rsa.py to rsa.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/media/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/media/data.py to data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/geo/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/geo/data.py to data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/exif/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/dublincore/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/dublincore/data.py to data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs/client.py to client.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs/data.py to data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs/service.py to service.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contentforshopping/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contentforshopping/client.py to client.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contentforshopping/data.py to data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts/data.py to data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts/service.py to service.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts/client.py to client.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/codesearch/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/codesearch/service.py to service.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar_resource/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar_resource/client.py to client.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar_resource/data.py to data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/client.py to client.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/data.py to data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py to service.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger/client.py to client.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger/data.py to data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger/service.py to service.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization/client.py to client.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization/data.py to data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization/service.py to service.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/multidomain/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/multidomain/client.py to client.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/multidomain/data.py to data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/migration/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/migration/service.py to service.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups/client.py to client.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups/data.py to data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups/service.py to service.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings/client.py to client.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings/data.py to data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings/service.py to service.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/audit/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/audit/service.py to service.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/adminsettings/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/adminsettings/service.py to service.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/apps_property_entry.py to apps_property_entry.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/client.py to client.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/data.py to data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/service.py to service.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics/client.py to client.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics/data.py to data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics/service.py to service.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt/app_engine.py to app_engine.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt/appengine.py to appengine.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/acl/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/acl/data.py to data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps_property.py to apps_property.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/auth.py to auth.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/client.py to client.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/core.py to core.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/data.py to data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/gauth.py to gauth.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sample_util.py to sample_util.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/service.py to service.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/test_config.py to test_config.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/test_data.py to test_data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/urlfetch.py to urlfetch.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/__init__.py to __init__.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/auth.py to auth.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/client.py to client.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/core.py to core.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/data.py to data.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/http.py to http.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/http_core.py to http_core.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/http_interface.py to http_interface.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/mock_http.py to mock_http.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/mock_http_core.py to mock_http_core.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/mock_service.py to mock_service.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/service.py to service.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/token_store.py to token_store.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/url.py to url.cpython-38.pyc running install_egg_info Writing /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata-2.0.18-py3.8.egg-info /usr/lib/python3.8/distutils/dist.py:274: UserWarning: Unknown distribution option: 'install_requires' warnings.warn(msg) /usr/lib/python3/site-packages/gdata/youtube/service.py:1400: SyntaxWarning: "is" with a literal. Did you mean "=="? /usr/lib/python3/site-packages/gdata/youtube/service.py:1400: SyntaxWarning: "is" with a literal. Did you mean "=="? /usr/lib/python3/site-packages/gdata/youtube/service.py:1535: SyntaxWarning: "is" with a literal. Did you mean "=="? /usr/lib/python3/site-packages/gdata/youtube/service.py:1538: SyntaxWarning: "is" with a literal. Did you mean "=="? /usr/lib/python3/site-packages/gdata/calendar/service.py:490: SyntaxWarning: "is not" with a literal. Did you mean "!="? /usr/lib/python3/site-packages/gdata/calendar/service.py:490: SyntaxWarning: "is not" with a literal. Did you mean "!="? /usr/lib/python3/site-packages/gdata/calendar/service.py:504: SyntaxWarning: "is not" with a literal. Did you mean "!="? /usr/lib/python3/site-packages/gdata/calendar/service.py:504: SyntaxWarning: "is not" with a literal. Did you mean "!="? /usr/lib/python3/site-packages/gdata/calendar/service.py:505: SyntaxWarning: "is not" with a literal. Did you mean "!="? /usr/lib/python3/site-packages/gdata/calendar/service.py:505: SyntaxWarning: "is not" with a literal. Did you mean "!="? /usr/lib/python3/site-packages/gdata/calendar/service.py:505: SyntaxWarning: "is not" with a literal. Did you mean "!="? /usr/lib/python3/site-packages/gdata/calendar/service.py:506: SyntaxWarning: "is not" with a literal. Did you mean "!="? + chmod -x samples/analytics/account_feed_demo.py samples/analytics/data_feed_demo.py samples/analytics/mgmt_feed_demo.py samples/apps/adminsettings_example.py samples/apps/create_update_group.py samples/apps/email_audit_email_monitoring.py samples/apps/email_settings_labels_filters.py samples/apps/emailsettings_example.py samples/apps/groups_provisioning_quick_start_example.py samples/apps/list_group_members.py samples/apps/migration_example.py samples/apps/multidomain_quick_start_example.py samples/apps/org_unit_sites.py samples/apps/orgunit_quick_start_example.py samples/apps/provisioning_oauth2_example.py samples/apps/search_organize_users.py samples/apps/suspended_users_cleanup.py samples/apps/user_profile_contacts_2lo.py samples/apps/userprovisioning_quick_start_example.py samples/authsub/secure_authsub.py samples/blogger/BloggerExample.py samples/blogger/BloggerExampleV1.py samples/calendar/calendarExample.py samples/calendar_resource/calendar_resource_example.py samples/codesearch/CodesearchExample.py samples/contacts/contacts_example.py samples/contacts/profiles_example.py samples/contacts/unshare_profiles.py samples/contentforshopping/add_batch_products.py samples/contentforshopping/add_product.py samples/contentforshopping/ca_insert.py samples/contentforshopping/ca_list.py samples/contentforshopping/list_products.py samples/docs/docs_example.py samples/docs/docs_v3_example.py samples/docs/samplerunner.py samples/finance/test_finance.py samples/mashups/birthdaySample.py samples/oauth/2_legged_oauth.py samples/oauth/TwoLeggedOAuthExample.py samples/oauth/oauth_example.py samples/sites/sites_example.py samples/spreadsheets/spreadsheetExample.py samples/webmastertools/AddDeleteExampleDotCom.py samples/webmastertools/SitemapsFeedSummary.py samples/webmastertools/SitesFeedSummary.py + rm -rf src/gdata/Crypto/test.py + rm -rf src/gdata/Crypto/Util/test.py + install -d /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance + install -d /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/__pycache__ ++ find src/gdata/finance -name '*.py' + for i in $(find src/gdata/finance -name '*.py') + install -p -m644 src/gdata/finance/service.py /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/ + for i in $(find src/gdata/finance -name '*.py') + install -p -m644 src/gdata/finance/data.py /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/ + for i in $(find src/gdata/finance -name '*.py') + install -p -m644 src/gdata/finance/__init__.py /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/ ++ find src/gdata/finance/__pycache__ -name '*.pyc' find: 'src/gdata/finance/__pycache__': No such file or directory + /usr/lib/rpm/brp-alt Cleaning files in /usr/src/tmp/python3-module-gdata-buildroot (auto) Verifying and fixing files in /usr/src/tmp/python3-module-gdata-buildroot (binconfig,pkgconfig,libtool,desktop) Checking contents of files in /usr/src/tmp/python3-module-gdata-buildroot/ (default) Compressing files in /usr/src/tmp/python3-module-gdata-buildroot (auto) Adjusting library links in /usr/src/tmp/python3-module-gdata-buildroot ./usr/lib: Verifying ELF objects in /usr/src/tmp/python3-module-gdata-buildroot (arch=normal,fhs=normal,lfs=relaxed,lint=relaxed,rpath=normal,stack=normal,textrel=normal,unresolved=normal) Bytecompiling python modules in /usr/src/tmp/python3-module-gdata-buildroot using /usr/bin/python2.7 Bytecompiling python modules with optimization in /usr/src/tmp/python3-module-gdata-buildroot using /usr/bin/python2.7 -O Bytecompiling python3 modules in /usr/src/tmp/python3-module-gdata-buildroot using /usr/bin/python3 unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/__pycache__/auth.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/__pycache__/client.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/__pycache__/core.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/__pycache__/data.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/__pycache__/http.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/__pycache__/http_core.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/__pycache__/http_interface.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/__pycache__/mock_http.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/__pycache__/mock_http_core.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/__pycache__/mock_service.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/__pycache__/service.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/__pycache__/token_store.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/__pycache__/url.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/auth.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/core.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/http.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/http_core.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/http_interface.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/mock_http.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/mock_http_core.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/mock_service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/token_store.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/url.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/__pycache__/apps_property.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/__pycache__/auth.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/__pycache__/client.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/__pycache__/core.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/__pycache__/data.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/__pycache__/gauth.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/__pycache__/sample_util.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/__pycache__/service.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/__pycache__/test_config.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/__pycache__/test_data.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/__pycache__/urlfetch.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/acl/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/acl/__pycache__/data.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/acl/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/acl/data.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt/__pycache__/app_engine.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt/__pycache__/appengine.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt/app_engine.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt/appengine.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics/__pycache__/client.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics/__pycache__/data.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics/__pycache__/service.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics/service.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/__pycache__/apps_property_entry.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/__pycache__/client.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/__pycache__/data.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/__pycache__/service.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/adminsettings/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/adminsettings/__pycache__/service.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/adminsettings/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/adminsettings/service.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/audit/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/audit/__pycache__/service.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/audit/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/audit/service.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/client.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/data.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/service.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings/service.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/client.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/data.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/service.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups/service.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/migration/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/migration/__pycache__/service.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/migration/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/migration/service.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/client.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/data.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/multidomain/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/multidomain/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/multidomain/data.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/client.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/data.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/service.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/apps_property_entry.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/service.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger/__pycache__/client.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger/__pycache__/data.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger/__pycache__/service.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger/service.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/__pycache__/client.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/__pycache__/data.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/__pycache__/service.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/client.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/data.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar_resource/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar_resource/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar_resource/data.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/codesearch/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/codesearch/__pycache__/service.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/codesearch/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/codesearch/service.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts/__pycache__/client.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts/__pycache__/data.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts/__pycache__/service.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts/service.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/client.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/data.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contentforshopping/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contentforshopping/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contentforshopping/data.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs/__pycache__/client.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs/__pycache__/data.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs/__pycache__/service.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs/service.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/dublincore/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/dublincore/__pycache__/data.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/dublincore/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/dublincore/data.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/exif/__pycache__/__init__.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/exif/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/service.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/geo/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/geo/__pycache__/data.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/geo/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/geo/data.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/media/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/media/__pycache__/data.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/media/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/media/data.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/oauth/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/oauth/__pycache__/rsa.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/oauth/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/oauth/rsa.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/opensearch/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/opensearch/__pycache__/data.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/opensearch/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/opensearch/data.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/photos/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/photos/__pycache__/service.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/photos/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/photos/service.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/client.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/data.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/projecthosting/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/projecthosting/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/projecthosting/data.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sites/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sites/__pycache__/client.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sites/__pycache__/data.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sites/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sites/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sites/data.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/service.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/text_db.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheet/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheet/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheet/text_db.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/client.cpython-38.pyc/usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py:490: SyntaxWarning: "is not" with a literal. Did you mean "!="? if val is not 'lastmodified' and val is not 'starttime': /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py:490: SyntaxWarning: "is not" with a literal. Did you mean "!="? if val is not 'lastmodified' and val is not 'starttime': /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py:504: SyntaxWarning: "is not" with a literal. Did you mean "!="? if (val is not 'ascending' and val is not 'descending' /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py:504: SyntaxWarning: "is not" with a literal. Did you mean "!="? if (val is not 'ascending' and val is not 'descending' /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py:505: SyntaxWarning: "is not" with a literal. Did you mean "!="? and val is not 'a' and val is not 'd' and val is not 'ascend' /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py:505: SyntaxWarning: "is not" with a literal. Did you mean "!="? and val is not 'a' and val is not 'd' and val is not 'ascend' /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py:505: SyntaxWarning: "is not" with a literal. Did you mean "!="? and val is not 'a' and val is not 'd' and val is not 'ascend' /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py:506: SyntaxWarning: "is not" with a literal. Did you mean "!="? and val is not 'descend'): /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/service.py:36: SyntaxWarning: "is" with a literal. Did you mean "=="? if value is 'true' or value is True: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/service.py:45: SyntaxWarning: "is" with a literal. Did you mean "=="? if value is 'true' or value is True: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/service.py:59: SyntaxWarning: "is" with a literal. Did you mean "=="? if value is 'true' or value is True: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/service.py:69: SyntaxWarning: "is" with a literal. Did you mean "=="? if value is 'true' or value is True: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/service.py:1400: SyntaxWarning: "is" with a literal. Did you mean "=="? elif (feed_type is 'responses' or feed_type is 'comments' and video_id /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/service.py:1400: SyntaxWarning: "is" with a literal. Did you mean "=="? elif (feed_type is 'responses' or feed_type is 'comments' and video_id /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/service.py:1535: SyntaxWarning: "is" with a literal. Did you mean "=="? if feed_type is 'subscriptions' and subscription_id and username: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/service.py:1538: SyntaxWarning: "is" with a literal. Did you mean "=="? elif feed_type is 'subscriptions' and not subscription_id and username: unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/data.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheets/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheets/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheets/data.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/data.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/service.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools/service.py unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/__pycache__/client.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/__pycache__/data.cpython-38.pyc unlink /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/__pycache__/service.cpython-38.pyc compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps_property.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/auth.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/core.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/gauth.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sample_util.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/test_config.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/test_data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/urlfetch.py Bytecompiling python3 modules with optimization in /usr/src/tmp/python3-module-gdata-buildroot using /usr/bin/python3 -O compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/auth.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/core.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/http.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/http_core.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/http_interface.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/mock_http.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/mock_http_core.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/mock_service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/token_store.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/url.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/acl/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/acl/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt/app_engine.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt/appengine.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/adminsettings/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/adminsettings/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/audit/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/audit/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/migration/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/migration/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/multidomain/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/multidomain/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/multidomain/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/apps_property_entry.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar_resource/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar_resource/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar_resource/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/codesearch/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/codesearch/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contentforshopping/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contentforshopping/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contentforshopping/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/dublincore/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/dublincore/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/exif/__init__.py/usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py:490: SyntaxWarning: "is not" with a literal. Did you mean "!="? if val is not 'lastmodified' and val is not 'starttime': /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py:490: SyntaxWarning: "is not" with a literal. Did you mean "!="? if val is not 'lastmodified' and val is not 'starttime': /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py:504: SyntaxWarning: "is not" with a literal. Did you mean "!="? if (val is not 'ascending' and val is not 'descending' /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py:504: SyntaxWarning: "is not" with a literal. Did you mean "!="? if (val is not 'ascending' and val is not 'descending' /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py:505: SyntaxWarning: "is not" with a literal. Did you mean "!="? and val is not 'a' and val is not 'd' and val is not 'ascend' /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py:505: SyntaxWarning: "is not" with a literal. Did you mean "!="? and val is not 'a' and val is not 'd' and val is not 'ascend' /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py:505: SyntaxWarning: "is not" with a literal. Did you mean "!="? and val is not 'a' and val is not 'd' and val is not 'ascend' /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py:506: SyntaxWarning: "is not" with a literal. Did you mean "!="? and val is not 'descend'): /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/service.py:36: SyntaxWarning: "is" with a literal. Did you mean "=="? if value is 'true' or value is True: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/service.py:45: SyntaxWarning: "is" with a literal. Did you mean "=="? if value is 'true' or value is True: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/service.py:59: SyntaxWarning: "is" with a literal. Did you mean "=="? if value is 'true' or value is True: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/service.py:69: SyntaxWarning: "is" with a literal. Did you mean "=="? if value is 'true' or value is True: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/service.py:1400: SyntaxWarning: "is" with a literal. Did you mean "=="? elif (feed_type is 'responses' or feed_type is 'comments' and video_id /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/service.py:1400: SyntaxWarning: "is" with a literal. Did you mean "=="? elif (feed_type is 'responses' or feed_type is 'comments' and video_id /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/service.py:1535: SyntaxWarning: "is" with a literal. Did you mean "=="? if feed_type is 'subscriptions' and subscription_id and username: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/service.py:1538: SyntaxWarning: "is" with a literal. Did you mean "=="? elif feed_type is 'subscriptions' and not subscription_id and username: compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/geo/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/geo/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/media/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/media/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/oauth/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/oauth/rsa.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/opensearch/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/opensearch/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/photos/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/photos/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/projecthosting/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/projecthosting/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/projecthosting/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sites/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sites/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sites/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheet/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheet/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheet/text_db.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheets/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheets/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheets/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps_property.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/auth.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/core.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/gauth.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sample_util.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/test_config.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/test_data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/urlfetch.py Bytecompiling python3 modules with optimization-2 in /usr/src/tmp/python3-module-gdata-buildroot using /usr/bin/python3 -OO compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/auth.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/core.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/http.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/http_core.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/http_interface.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/mock_http.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/mock_http_core.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/mock_service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/token_store.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/url.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/acl/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/acl/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt/app_engine.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt/appengine.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/adminsettings/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/adminsettings/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/audit/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/audit/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/migration/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/migration/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/multidomain/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/multidomain/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/multidomain/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/apps_property_entry.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar_resource/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar_resource/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar_resource/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/codesearch/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/codesearch/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contentforshopping/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contentforshopping/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contentforshopping/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/dublincore/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/dublincore/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/exif/__init__.py/usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py:490: SyntaxWarning: "is not" with a literal. Did you mean "!="? if val is not 'lastmodified' and val is not 'starttime': /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py:490: SyntaxWarning: "is not" with a literal. Did you mean "!="? if val is not 'lastmodified' and val is not 'starttime': /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py:504: SyntaxWarning: "is not" with a literal. Did you mean "!="? if (val is not 'ascending' and val is not 'descending' /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py:504: SyntaxWarning: "is not" with a literal. Did you mean "!="? if (val is not 'ascending' and val is not 'descending' /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py:505: SyntaxWarning: "is not" with a literal. Did you mean "!="? and val is not 'a' and val is not 'd' and val is not 'ascend' /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py:505: SyntaxWarning: "is not" with a literal. Did you mean "!="? and val is not 'a' and val is not 'd' and val is not 'ascend' /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py:505: SyntaxWarning: "is not" with a literal. Did you mean "!="? and val is not 'a' and val is not 'd' and val is not 'ascend' /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/service.py:506: SyntaxWarning: "is not" with a literal. Did you mean "!="? and val is not 'descend'): /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/service.py:36: SyntaxWarning: "is" with a literal. Did you mean "=="? if value is 'true' or value is True: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/service.py:45: SyntaxWarning: "is" with a literal. Did you mean "=="? if value is 'true' or value is True: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/service.py:59: SyntaxWarning: "is" with a literal. Did you mean "=="? if value is 'true' or value is True: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/service.py:69: SyntaxWarning: "is" with a literal. Did you mean "=="? if value is 'true' or value is True: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/service.py:1400: SyntaxWarning: "is" with a literal. Did you mean "=="? elif (feed_type is 'responses' or feed_type is 'comments' and video_id /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/service.py:1400: SyntaxWarning: "is" with a literal. Did you mean "=="? elif (feed_type is 'responses' or feed_type is 'comments' and video_id /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/service.py:1535: SyntaxWarning: "is" with a literal. Did you mean "=="? if feed_type is 'subscriptions' and subscription_id and username: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/service.py:1538: SyntaxWarning: "is" with a literal. Did you mean "=="? elif feed_type is 'subscriptions' and not subscription_id and username: compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/geo/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/geo/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/media/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/media/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/oauth/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/oauth/rsa.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/opensearch/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/opensearch/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/photos/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/photos/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/projecthosting/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/projecthosting/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/projecthosting/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sites/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sites/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sites/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheet/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheet/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheet/text_db.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheets/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheets/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheets/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/__init__.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps_property.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/auth.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/client.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/core.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/gauth.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sample_util.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/service.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/test_config.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/test_data.py compile /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/urlfetch.py Hardlinking identical .pyc and .opt-?.pyc files './usr/lib/python3/site-packages/atom/__pycache__/url.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/atom/__pycache__/url.cpython-38.pyc' './usr/lib/python3/site-packages/atom/__pycache__/token_store.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/atom/__pycache__/token_store.cpython-38.pyc' './usr/lib/python3/site-packages/atom/__pycache__/service.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/atom/__pycache__/service.cpython-38.pyc' './usr/lib/python3/site-packages/atom/__pycache__/mock_service.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/atom/__pycache__/mock_service.cpython-38.pyc' './usr/lib/python3/site-packages/atom/__pycache__/mock_http_core.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/atom/__pycache__/mock_http_core.cpython-38.pyc' './usr/lib/python3/site-packages/atom/__pycache__/mock_http.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/atom/__pycache__/mock_http.cpython-38.pyc' './usr/lib/python3/site-packages/atom/__pycache__/http_interface.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/atom/__pycache__/http_interface.cpython-38.pyc' './usr/lib/python3/site-packages/atom/__pycache__/http_core.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/atom/__pycache__/http_core.cpython-38.pyc' './usr/lib/python3/site-packages/atom/__pycache__/http.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/atom/__pycache__/http.cpython-38.pyc' './usr/lib/python3/site-packages/atom/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/atom/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/atom/__pycache__/core.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/atom/__pycache__/core.cpython-38.pyc' './usr/lib/python3/site-packages/atom/__pycache__/client.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/atom/__pycache__/client.cpython-38.pyc' './usr/lib/python3/site-packages/atom/__pycache__/auth.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/atom/__pycache__/auth.cpython-38.pyc' './usr/lib/python3/site-packages/atom/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/atom/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/finance/__pycache__/service.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/finance/__pycache__/service.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/finance/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/finance/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/finance/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/finance/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/__pycache__/urlfetch.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/__pycache__/urlfetch.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/__pycache__/test_data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/__pycache__/test_data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/__pycache__/test_data.cpython-38.opt-2.pyc' => './usr/lib/python3/site-packages/gdata/__pycache__/test_data.cpython-38.opt-1.pyc' './usr/lib/python3/site-packages/gdata/__pycache__/test_config.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/__pycache__/test_config.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/__pycache__/service.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/__pycache__/service.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/__pycache__/sample_util.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/__pycache__/sample_util.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/__pycache__/gauth.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/__pycache__/gauth.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/__pycache__/core.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/__pycache__/core.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/__pycache__/client.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/__pycache__/client.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/__pycache__/auth.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/__pycache__/auth.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/__pycache__/apps_property.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/__pycache__/apps_property.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/acl/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/acl/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/acl/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/acl/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/acl/__pycache__/__init__.cpython-38.opt-2.pyc' => './usr/lib/python3/site-packages/gdata/acl/__pycache__/__init__.cpython-38.opt-1.pyc' './usr/lib/python3/site-packages/gdata/alt/__pycache__/appengine.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/alt/__pycache__/appengine.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/alt/__pycache__/app_engine.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/alt/__pycache__/app_engine.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/alt/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/alt/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/analytics/__pycache__/service.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/analytics/__pycache__/service.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/analytics/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/analytics/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/analytics/__pycache__/client.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/analytics/__pycache__/client.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/analytics/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/analytics/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/__pycache__/service.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/__pycache__/service.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/__pycache__/client.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/__pycache__/client.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/__pycache__/apps_property_entry.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/__pycache__/apps_property_entry.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/adminsettings/__pycache__/service.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/adminsettings/__pycache__/service.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/adminsettings/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/adminsettings/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/adminsettings/__pycache__/__init__.cpython-38.opt-2.pyc' => './usr/lib/python3/site-packages/gdata/apps/adminsettings/__pycache__/__init__.cpython-38.opt-1.pyc' './usr/lib/python3/site-packages/gdata/apps/audit/__pycache__/service.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/audit/__pycache__/service.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/audit/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/audit/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/audit/__pycache__/__init__.cpython-38.opt-2.pyc' => './usr/lib/python3/site-packages/gdata/apps/audit/__pycache__/__init__.cpython-38.opt-1.pyc' './usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/service.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/service.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/client.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/client.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/__init__.cpython-38.opt-2.pyc' => './usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/__init__.cpython-38.opt-1.pyc' './usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/service.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/service.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/client.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/client.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/__init__.cpython-38.opt-2.pyc' => './usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/__init__.cpython-38.opt-1.pyc' './usr/lib/python3/site-packages/gdata/apps/migration/__pycache__/service.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/migration/__pycache__/service.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/migration/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/migration/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/client.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/client.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/__init__.cpython-38.opt-2.pyc' => './usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/__init__.cpython-38.opt-1.pyc' './usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/service.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/service.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/client.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/client.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/__init__.cpython-38.opt-2.pyc' => './usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/__init__.cpython-38.opt-1.pyc' './usr/lib/python3/site-packages/gdata/blogger/__pycache__/service.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/blogger/__pycache__/service.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/blogger/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/blogger/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/blogger/__pycache__/client.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/blogger/__pycache__/client.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/blogger/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/blogger/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/calendar/__pycache__/service.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/calendar/__pycache__/service.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/calendar/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/calendar/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/calendar/__pycache__/client.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/calendar/__pycache__/client.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/calendar/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/calendar/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/client.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/client.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/__init__.cpython-38.opt-2.pyc' => './usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/__init__.cpython-38.opt-1.pyc' './usr/lib/python3/site-packages/gdata/codesearch/__pycache__/service.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/codesearch/__pycache__/service.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/codesearch/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/codesearch/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/contacts/__pycache__/service.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/contacts/__pycache__/service.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/contacts/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/contacts/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/contacts/__pycache__/client.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/contacts/__pycache__/client.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/contacts/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/contacts/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/client.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/client.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/docs/__pycache__/service.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/docs/__pycache__/service.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/docs/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/docs/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/docs/__pycache__/client.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/docs/__pycache__/client.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/docs/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/docs/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/dublincore/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/dublincore/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/dublincore/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/dublincore/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/dublincore/__pycache__/__init__.cpython-38.opt-2.pyc' => './usr/lib/python3/site-packages/gdata/dublincore/__pycache__/__init__.cpython-38.opt-1.pyc' './usr/lib/python3/site-packages/gdata/exif/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/exif/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/geo/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/geo/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/media/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/media/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/media/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/media/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/oauth/__pycache__/rsa.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/oauth/__pycache__/rsa.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/oauth/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/oauth/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/opensearch/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/opensearch/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/opensearch/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/opensearch/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/opensearch/__pycache__/__init__.cpython-38.opt-2.pyc' => './usr/lib/python3/site-packages/gdata/opensearch/__pycache__/__init__.cpython-38.opt-1.pyc' './usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/client.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/client.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/__init__.cpython-38.opt-2.pyc' => './usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/__init__.cpython-38.opt-1.pyc' './usr/lib/python3/site-packages/gdata/sites/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/sites/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/sites/__pycache__/client.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/sites/__pycache__/client.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/sites/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/sites/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/sites/__pycache__/__init__.cpython-38.opt-2.pyc' => './usr/lib/python3/site-packages/gdata/sites/__pycache__/__init__.cpython-38.opt-1.pyc' './usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/text_db.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/text_db.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/service.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/service.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/client.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/client.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/__init__.cpython-38.opt-2.pyc' => './usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/__init__.cpython-38.opt-1.pyc' './usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/service.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/service.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/youtube/__pycache__/data.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/youtube/__pycache__/data.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/youtube/__pycache__/client.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/youtube/__pycache__/client.cpython-38.pyc' './usr/lib/python3/site-packages/gdata/youtube/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/gdata/youtube/__pycache__/__init__.cpython-38.pyc' Hardlinking identical .pyc and .pyo files Processing files: python3-module-gdata-2.0.18-alt4 Executing(%doc): /bin/sh -e /usr/src/tmp/rpm-tmp.27102 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd python3-module-gdata-2.0.18 + DOCDIR=/usr/src/tmp/python3-module-gdata-buildroot/usr/share/doc/python3-module-gdata-2.0.18 + export DOCDIR + rm -rf /usr/src/tmp/python3-module-gdata-buildroot/usr/share/doc/python3-module-gdata-2.0.18 + /bin/mkdir -p /usr/src/tmp/python3-module-gdata-buildroot/usr/share/doc/python3-module-gdata-2.0.18 + cp -prL INSTALL.txt README.txt RELEASE_NOTES.txt /usr/src/tmp/python3-module-gdata-buildroot/usr/share/doc/python3-module-gdata-2.0.18 + chmod -R go-w /usr/src/tmp/python3-module-gdata-buildroot/usr/share/doc/python3-module-gdata-2.0.18 + chmod -R a+rX /usr/src/tmp/python3-module-gdata-buildroot/usr/share/doc/python3-module-gdata-2.0.18 + exit 0 Finding Provides (using /usr/lib/rpm/find-provides) Executing: /bin/sh -e /usr/src/tmp/rpm-tmp.0Qohzh find-provides: running scripts (alternatives,debuginfo,lib,pam,perl,pkgconfig,python,python3,shell) Finding Requires (using /usr/lib/rpm/find-requires) Executing: /bin/sh -e /usr/src/tmp/rpm-tmp.QJMxBf find-requires: running scripts (cpp,debuginfo,files,lib,pam,perl,pkgconfig,pkgconfiglib,python,python3,rpmlib,shebang,shell,static,symlinks,systemd-services) /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/__init__.py: line=47 IGNORE (for REQ=slight and deep=8) module=xml.etree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/__init__.py: line=50 IGNORE (for REQ=slight and deep=12) module=cElementTree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/__init__.py: line=53 IGNORE (for REQ=slight and deep=16) module=xml.etree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/__init__.py: line=55 IGNORE (for REQ=slight and deep=16) module=elementtree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/core.py: line=26 IGNORE (for REQ=slight and deep=8) module=xml.etree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/core.py: line=29 IGNORE (for REQ=slight and deep=12) module=cElementTree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/core.py: line=32 IGNORE (for REQ=slight and deep=16) module=xml.etree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/core.py: line=34 IGNORE (for REQ=slight and deep=16) module=elementtree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/core.py: line=38 IGNORE (for REQ=slight and deep=8) module=xml.dom.minidom /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/http.py: line=49 IGNORE (for REQ=slight and deep=8) module=ssl /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/http_core.py: line=32 IGNORE (for REQ=slight and deep=8) module=ssl /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/http_core.py: line=539 IGNORE (for REQ=slight and deep=15) module=socket /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/http_core.py: line=589 IGNORE (for REQ=slight and deep=8) module=base64 /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/mock_service.py: line=37 IGNORE (for REQ=slight and deep=8) module=sha /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/service.py: line=45 IGNORE (for REQ=slight and deep=8) module=xml.etree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/service.py: line=48 IGNORE (for REQ=slight and deep=12) module=cElementTree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/service.py: line=51 IGNORE (for REQ=slight and deep=16) module=xml.etree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/service.py: line=53 IGNORE (for REQ=slight and deep=16) module=elementtree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/__init__.py: line=28 IGNORE (for REQ=slight and deep=8) module=xml.etree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/__init__.py: line=31 IGNORE (for REQ=slight and deep=12) module=cElementTree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/__init__.py: line=34 IGNORE (for REQ=slight and deep=16) module=xml.etree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/__init__.py: line=36 IGNORE (for REQ=slight and deep=16) module=elementtree python3.req: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt/app_engine.py: skipping google.appengine.ext python3.req: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt/app_engine.py: skipping google.appengine.api python3.req: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt/appengine.py: skipping google.appengine.api python3.req: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt/appengine.py: skipping google.appengine.ext python3.req: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt/appengine.py: skipping google.appengine.api python3.req: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt/appengine.py: skipping google.appengine.api /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/adminsettings/service.py: line=235 IGNORE (for REQ=slight and deep=11) module=urllib.request /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/adminsettings/service.py: line=235 IGNORE (for REQ=slight and deep=11) module=urllib.parse /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/adminsettings/service.py: line=235 IGNORE (for REQ=slight and deep=11) module=urllib.error /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/adminsettings/service.py: line=248 IGNORE (for REQ=slight and deep=11) module=base64 python3.req: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/migration/service.py: skipping time /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/service.py: line=19 IGNORE (for REQ=slight and deep=8) module=xml.etree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/service.py: line=22 IGNORE (for REQ=slight and deep=12) module=cElementTree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/service.py: line=25 IGNORE (for REQ=slight and deep=16) module=xml.etree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/service.py: line=27 IGNORE (for REQ=slight and deep=16) module=elementtree python3.req: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/auth.py: skipping time /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/__init__.py: line=24 IGNORE (for REQ=slight and deep=8) module=xml.etree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/__init__.py: line=27 IGNORE (for REQ=slight and deep=12) module=cElementTree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/__init__.py: line=30 IGNORE (for REQ=slight and deep=16) module=xml.etree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/__init__.py: line=32 IGNORE (for REQ=slight and deep=16) module=elementtree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/core.py: line=36 IGNORE (for REQ=slight and deep=8) module=simplejson /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/core.py: line=40 IGNORE (for REQ=slight and deep=12) module=django.utils /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/core.py: line=43 IGNORE (for REQ=slight and deep=12) module=json /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/exif/__init__.py: line=167 IGNORE (for REQ=slight and deep=11) module=time /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/exif/__init__.py: line=176 IGNORE (for REQ=slight and deep=11) module=datetime python3.req: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/gauth.py: skipping time /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/gauth.py: line=57 IGNORE (for REQ=slight and deep=8) module=simplejson /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/gauth.py: line=58 IGNORE (for REQ=slight and deep=8) module=simplejson.decoder /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/gauth.py: line=63 IGNORE (for REQ=slight and deep=12) module=django.utils /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/gauth.py: line=66 IGNORE (for REQ=slight and deep=12) module=json /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/gauth.py: line=69 IGNORE (for REQ=slight and deep=8) module=urllib.parse /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/gauth.py: line=71 IGNORE (for REQ=slight and deep=8) module=cgi /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/gauth.py: line=502 IGNORE (for REQ=slight and deep=8) module=base64 /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/gauth.py: line=503 IGNORE (for REQ=slight and deep=8) module=tlslite.utils /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/gauth.py: line=658 IGNORE (for REQ=slight and deep=8) module=hmac /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/gauth.py: line=659 IGNORE (for REQ=slight and deep=8) module=base64 /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/gauth.py: line=671 IGNORE (for REQ=slight and deep=12) module=hashlib /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/gauth.py: line=674 IGNORE (for REQ=slight and deep=12) module=sha /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/gauth.py: line=686 IGNORE (for REQ=slight and deep=8) module=base64 /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/gauth.py: line=687 IGNORE (for REQ=slight and deep=8) module=tlslite.utils /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/gauth.py: line=1472 IGNORE (for REQ=slight and deep=11) module=httplib2 /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/gauth.py: line=1673 IGNORE (for REQ=slight and deep=8) module=gdata.alt.app_engine /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/gauth.py: line=1695 IGNORE (for REQ=slight and deep=8) module=gdata.alt.app_engine /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/gauth.py: line=1709 IGNORE (for REQ=slight and deep=8) module=gdata.alt.app_engine python3.req: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/oauth/__init__.py: skipping time /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/oauth/__init__.py: line=507 IGNORE (for REQ=slight and deep=15) module=hashlib /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/oauth/__init__.py: line=510 IGNORE (for REQ=slight and deep=15) module=sha /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/photos/__init__.py: line=42 IGNORE (for REQ=slight and deep=8) module=xml.etree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/photos/__init__.py: line=45 IGNORE (for REQ=slight and deep=12) module=cElementTree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/photos/__init__.py: line=48 IGNORE (for REQ=slight and deep=16) module=xml.etree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/photos/__init__.py: line=50 IGNORE (for REQ=slight and deep=16) module=elementtree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/photos/__init__.py: line=430 IGNORE (for REQ=slight and deep=11) module=time /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/photos/__init__.py: line=439 IGNORE (for REQ=slight and deep=11) module=datetime python3.req: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/photos/service.py: skipping sys python3.req: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/photos/service.py: skipping time python3.req: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sample_util.py: skipping sys /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/service.py: line=66 IGNORE (for REQ=slight and deep=8) module=xml.etree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/service.py: line=69 IGNORE (for REQ=slight and deep=12) module=cElementTree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/service.py: line=72 IGNORE (for REQ=slight and deep=16) module=xml.etree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/service.py: line=74 IGNORE (for REQ=slight and deep=16) module=elementtree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/service.py: line=250 IGNORE (for REQ=slight and deep=15) module=gdata.alt.appengine /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/service.py: line=975 IGNORE (for REQ=slight and deep=11) module=time /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheet/__init__.py: line=23 IGNORE (for REQ=slight and deep=8) module=xml.etree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheet/__init__.py: line=26 IGNORE (for REQ=slight and deep=12) module=cElementTree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheet/__init__.py: line=29 IGNORE (for REQ=slight and deep=16) module=xml.etree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheet/__init__.py: line=31 IGNORE (for REQ=slight and deep=16) module=elementtree python3.req: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/test_config.py: skipping sys /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/test_config.py: line=396 IGNORE (for REQ=slight and deep=8) module=inspect python3.req: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/urlfetch.py: skipping google.appengine.api /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools/__init__.py: line=24 IGNORE (for REQ=slight and deep=8) module=xml.etree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools/__init__.py: line=27 IGNORE (for REQ=slight and deep=12) module=cElementTree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools/__init__.py: line=30 IGNORE (for REQ=slight and deep=16) module=xml.etree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools/__init__.py: line=32 IGNORE (for REQ=slight and deep=16) module=elementtree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/service.py: line=27 IGNORE (for REQ=slight and deep=8) module=xml.etree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/service.py: line=30 IGNORE (for REQ=slight and deep=12) module=cElementTree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/service.py: line=33 IGNORE (for REQ=slight and deep=16) module=xml.etree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/service.py: line=35 IGNORE (for REQ=slight and deep=16) module=elementtree /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/service.py: line=637 IGNORE (for REQ=slight and deep=15) module=io shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/auth.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/client.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/core.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/http.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/http_core.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/http_interface.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/mock_http.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/mock_http_core.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/mock_service.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/token_store.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/atom/url.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/acl/__init__.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/acl/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt/__init__.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt/app_engine.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/alt/appengine.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics/__init__.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics/client.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/analytics/service.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/adminsettings/__init__.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/adminsettings/service.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/apps_property_entry.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings/__init__.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings/client.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/emailsettings/service.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups/client.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/groups/service.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/migration/__init__.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/migration/service.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/multidomain/client.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/multidomain/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization/client.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps/organization/service.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/apps_property.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/auth.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger/__init__.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger/client.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/blogger/service.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/client.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar_resource/client.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/calendar_resource/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/client.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts/__init__.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts/client.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contacts/service.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contentforshopping/__init__.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contentforshopping/client.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/contentforshopping/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/core.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs/client.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/docs/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/dublincore/__init__.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/dublincore/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/__init__.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/finance/service.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/gauth.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/geo/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/media/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/oauth/rsa.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/opensearch/__init__.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/opensearch/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/photos/service.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/projecthosting/client.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/projecthosting/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sample_util.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sites/client.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/sites/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheet/text_db.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheets/client.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/spreadsheets/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/test_config.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/urlfetch.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools/__init__.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/webmastertools/service.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/__init__.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/client.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/data.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-gdata-buildroot/usr/lib/python3/site-packages/gdata/youtube/service.py is not executable Provides: python3(atom), python3(atom.auth), python3(atom.client), python3(atom.core), python3(atom.data), python3(atom.http), python3(atom.http_core), python3(atom.http_interface), python3(atom.mock_http), python3(atom.mock_http_core), python3(atom.mock_service), python3(atom.service), python3(atom.token_store), python3(atom.url), python3(gdata), python3(gdata.acl), python3(gdata.acl.data), python3(gdata.alt), python3(gdata.alt.app_engine), python3(gdata.alt.appengine), python3(gdata.analytics), python3(gdata.analytics.client), python3(gdata.analytics.data), python3(gdata.analytics.service), python3(gdata.apps), python3(gdata.apps.adminsettings), python3(gdata.apps.adminsettings.service), python3(gdata.apps.apps_property_entry), python3(gdata.apps.audit), python3(gdata.apps.audit.service), python3(gdata.apps.client), python3(gdata.apps.data), python3(gdata.apps.emailsettings), python3(gdata.apps.emailsettings.client), python3(gdata.apps.emailsettings.data), python3(gdata.apps.emailsettings.service), python3(gdata.apps.groups), python3(gdata.apps.groups.client), python3(gdata.apps.groups.data), python3(gdata.apps.groups.service), python3(gdata.apps.migration), python3(gdata.apps.migration.service), python3(gdata.apps.multidomain), python3(gdata.apps.multidomain.client), python3(gdata.apps.multidomain.data), python3(gdata.apps.organization), python3(gdata.apps.organization.client), python3(gdata.apps.organization.data), python3(gdata.apps.organization.service), python3(gdata.apps.service), python3(gdata.apps_property), python3(gdata.auth), python3(gdata.blogger), python3(gdata.blogger.client), python3(gdata.blogger.data), python3(gdata.blogger.service), python3(gdata.calendar), python3(gdata.calendar.client), python3(gdata.calendar.data), python3(gdata.calendar.service), python3(gdata.calendar_resource), python3(gdata.calendar_resource.client), python3(gdata.calendar_resource.data), python3(gdata.client), python3(gdata.codesearch), python3(gdata.codesearch.service), python3(gdata.contacts), python3(gdata.contacts.client), python3(gdata.contacts.data), python3(gdata.contacts.service), python3(gdata.contentforshopping), python3(gdata.contentforshopping.client), python3(gdata.contentforshopping.data), python3(gdata.core), python3(gdata.data), python3(gdata.docs), python3(gdata.docs.client), python3(gdata.docs.data), python3(gdata.docs.service), python3(gdata.dublincore), python3(gdata.dublincore.data), python3(gdata.exif), python3(gdata.finance), python3(gdata.finance.data), python3(gdata.finance.service), python3(gdata.gauth), python3(gdata.geo), python3(gdata.geo.data), python3(gdata.media), python3(gdata.media.data), python3(gdata.oauth), python3(gdata.oauth.rsa), python3(gdata.opensearch), python3(gdata.opensearch.data), python3(gdata.photos), python3(gdata.photos.service), python3(gdata.projecthosting), python3(gdata.projecthosting.client), python3(gdata.projecthosting.data), python3(gdata.sample_util), python3(gdata.service), python3(gdata.sites), python3(gdata.sites.client), python3(gdata.sites.data), python3(gdata.spreadsheet), python3(gdata.spreadsheet.service), python3(gdata.spreadsheet.text_db), python3(gdata.spreadsheets), python3(gdata.spreadsheets.client), python3(gdata.spreadsheets.data), python3(gdata.test_config), python3(gdata.test_data), python3(gdata.urlfetch), python3(gdata.webmastertools), python3(gdata.webmastertools.data), python3(gdata.webmastertools.service), python3(gdata.youtube), python3(gdata.youtube.client), python3(gdata.youtube.data), python3(gdata.youtube.service) Requires: /usr/lib/python3/site-packages, python3(base64) < 0, python3(binascii) < 0, python3(cgi) < 0, python3(copy) < 0, python3(datetime) < 0, python3(getpass) < 0, python3(hmac) < 0, python3(http.client) < 0, python3(inspect) < 0, python3(io) < 0, python3(logging) < 0, python3(math) < 0, python3(mimetypes) < 0, python3(os) < 0, python3(os.path) < 0, python3(pickle) < 0, python3(random) < 0, python3(re) < 0, python3(socket) < 0, python3(string) < 0, python3(tempfile) < 0, python3(threading) < 0, python3(tlslite.utils) < 0, python3(types) < 0, python3(unittest) < 0, python3(urllib.error) < 0, python3(urllib.parse) < 0, python3(urllib.request) < 0, python3(warnings) < 0 Processing files: python3-module-gdata-docs-2.0.18-alt4 Executing(%doc): /bin/sh -e /usr/src/tmp/rpm-tmp.54513 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd python3-module-gdata-2.0.18 + DOCDIR=/usr/src/tmp/python3-module-gdata-buildroot/usr/share/doc/python3-module-gdata-docs-2.0.18 + export DOCDIR + rm -rf /usr/src/tmp/python3-module-gdata-buildroot/usr/share/doc/python3-module-gdata-docs-2.0.18 + /bin/mkdir -p /usr/src/tmp/python3-module-gdata-buildroot/usr/share/doc/python3-module-gdata-docs-2.0.18 + cp -prL pydocs/atom.auth.html pydocs/atom.client.html pydocs/atom.core.html pydocs/atom.data.html pydocs/atom.html pydocs/atom.http.html pydocs/atom.http_core.html pydocs/atom.http_interface.html pydocs/atom.mock_http.html pydocs/atom.mock_http_core.html pydocs/atom.mock_service.html pydocs/atom.service.html pydocs/atom.token_store.html pydocs/atom.url.html pydocs/gdata.acl.data.html pydocs/gdata.acl.html pydocs/gdata.alt.app_engine.html pydocs/gdata.alt.appengine.html pydocs/gdata.alt.html pydocs/gdata.analytics.client.html pydocs/gdata.analytics.data.html pydocs/gdata.analytics.html pydocs/gdata.analytics.service.html pydocs/gdata.apps.adminsettings.html pydocs/gdata.apps.adminsettings.service.html pydocs/gdata.apps.apps_property_entry.html pydocs/gdata.apps.audit.html pydocs/gdata.apps.audit.service.html pydocs/gdata.apps.client.html pydocs/gdata.apps.data.html pydocs/gdata.apps.emailsettings.client.html pydocs/gdata.apps.emailsettings.data.html pydocs/gdata.apps.emailsettings.html pydocs/gdata.apps.emailsettings.service.html pydocs/gdata.apps.groups.client.html pydocs/gdata.apps.groups.data.html pydocs/gdata.apps.groups.html pydocs/gdata.apps.groups.service.html pydocs/gdata.apps.html pydocs/gdata.apps.migration.html pydocs/gdata.apps.migration.service.html pydocs/gdata.apps.multidomain.client.html pydocs/gdata.apps.multidomain.data.html pydocs/gdata.apps.multidomain.html pydocs/gdata.apps.organization.client.html pydocs/gdata.apps.organization.data.html pydocs/gdata.apps.organization.html pydocs/gdata.apps.organization.service.html pydocs/gdata.apps.service.html pydocs/gdata.apps_property.html pydocs/gdata.auth.html pydocs/gdata.blogger.client.html pydocs/gdata.blogger.data.html pydocs/gdata.blogger.html pydocs/gdata.blogger.service.html pydocs/gdata.books.data.html pydocs/gdata.books.html pydocs/gdata.books.service.html pydocs/gdata.calendar.client.html pydocs/gdata.calendar.data.html pydocs/gdata.calendar.html pydocs/gdata.calendar.service.html pydocs/gdata.calendar_resource.client.html pydocs/gdata.calendar_resource.data.html pydocs/gdata.calendar_resource.html pydocs/gdata.client.html pydocs/gdata.codesearch.html pydocs/gdata.codesearch.service.html pydocs/gdata.contacts.client.html pydocs/gdata.contacts.data.html pydocs/gdata.contacts.html pydocs/gdata.contacts.service.html pydocs/gdata.contentforshopping.client.html pydocs/gdata.contentforshopping.data.html pydocs/gdata.contentforshopping.html pydocs/gdata.core.html pydocs/gdata.data.html pydocs/gdata.docs.client.html pydocs/gdata.docs.data.html pydocs/gdata.docs.html pydocs/gdata.docs.service.html pydocs/gdata.dublincore.data.html pydocs/gdata.dublincore.html pydocs/gdata.exif.html pydocs/gdata.finance.data.html pydocs/gdata.finance.html pydocs/gdata.finance.service.html pydocs/gdata.gauth.html pydocs/gdata.geo.data.html pydocs/gdata.geo.html pydocs/gdata.health.html pydocs/gdata.health.service.html pydocs/gdata.html pydocs/gdata.maps.client.html pydocs/gdata.maps.html pydocs/gdata.marketplace.client.html pydocs/gdata.marketplace.data.html pydocs/gdata.marketplace.html pydocs/gdata.media.data.html pydocs/gdata.media.html pydocs/gdata.notebook.data.html pydocs/gdata.notebook.html pydocs/gdata.oauth.html pydocs/gdata.oauth.rsa.html pydocs/gdata.opensearch.data.html pydocs/gdata.opensearch.html pydocs/gdata.photos.html pydocs/gdata.photos.service.html pydocs/gdata.projecthosting.client.html pydocs/gdata.projecthosting.data.html pydocs/gdata.projecthosting.html pydocs/gdata.sample_util.html pydocs/gdata.service.html pydocs/gdata.sites.client.html pydocs/gdata.sites.data.html pydocs/gdata.sites.html pydocs/gdata.spreadsheet.html pydocs/gdata.spreadsheet.service.html pydocs/gdata.spreadsheet.text_db.html pydocs/gdata.spreadsheets.client.html pydocs/gdata.spreadsheets.data.html pydocs/gdata.spreadsheets.html pydocs/gdata.test_config.html pydocs/gdata.test_config_template.html pydocs/gdata.test_data.html pydocs/gdata.urlfetch.html pydocs/gdata.webmastertools.data.html pydocs/gdata.webmastertools.html pydocs/gdata.webmastertools.service.html pydocs/gdata.youtube.client.html pydocs/gdata.youtube.data.html pydocs/gdata.youtube.html pydocs/gdata.youtube.service.html pydocs/generate_docs /usr/src/tmp/python3-module-gdata-buildroot/usr/share/doc/python3-module-gdata-docs-2.0.18 + chmod -R go-w /usr/src/tmp/python3-module-gdata-buildroot/usr/share/doc/python3-module-gdata-docs-2.0.18 + chmod -R a+rX /usr/src/tmp/python3-module-gdata-buildroot/usr/share/doc/python3-module-gdata-docs-2.0.18 + exit 0 Finding Provides (using /usr/lib/rpm/find-provides) Executing: /bin/sh -e /usr/src/tmp/rpm-tmp.4SEpbj find-provides: running scripts (alternatives,debuginfo,lib,pam,perl,pkgconfig,python,python3,shell) Finding Requires (using /usr/lib/rpm/find-requires) Executing: /bin/sh -e /usr/src/tmp/rpm-tmp.Om2fki find-requires: running scripts (cpp,debuginfo,files,lib,pam,perl,pkgconfig,pkgconfiglib,python,python3,rpmlib,shebang,shell,static,symlinks,systemd-services) Wrote: /usr/src/RPM/RPMS/noarch/python3-module-gdata-2.0.18-alt4.noarch.rpm Wrote: /usr/src/RPM/RPMS/noarch/python3-module-gdata-docs-2.0.18-alt4.noarch.rpm 180.95user 3.53system 3:44.00elapsed 82%CPU (0avgtext+0avgdata 34360maxresident)k 0inputs+0outputs (0major+396130minor)pagefaults 0swaps 193.55user 11.32system 4:06.04elapsed 83%CPU (0avgtext+0avgdata 108604maxresident)k 0inputs+0outputs (0major+865008minor)pagefaults 0swaps --- python3-module-gdata-2.0.18-alt4.noarch.rpm.repo 2019-12-30 13:07:34.000000000 +0000 +++ python3-module-gdata-2.0.18-alt4.noarch.rpm.hasher 2020-04-16 14:51:56.600846917 +0000 @@ -3,44 +3,44 @@ /usr/lib/python3/site-packages/atom/__pycache__ 40755 -/usr/lib/python3/site-packages/atom/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/auth.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/auth.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/auth.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/client.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/client.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/client.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/core.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/core.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/core.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/data.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/http.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/http.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/http.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/http_core.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/http_core.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/http_core.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/http_interface.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/http_interface.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/http_interface.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/mock_http.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/mock_http.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/mock_http.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/mock_http_core.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/mock_http_core.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/mock_http_core.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/mock_service.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/mock_service.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/mock_service.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/service.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/service.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/service.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/token_store.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/token_store.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/token_store.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/url.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/url.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/atom/__pycache__/url.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/auth.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/auth.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/auth.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/client.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/client.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/client.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/core.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/core.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/core.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/data.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/http.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/http.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/http.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/http_core.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/http_core.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/http_core.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/http_interface.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/http_interface.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/http_interface.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/mock_http.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/mock_http.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/mock_http.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/mock_http_core.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/mock_http_core.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/mock_http_core.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/mock_service.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/mock_service.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/mock_service.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/service.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/service.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/service.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/token_store.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/token_store.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/token_store.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/url.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/url.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/atom/__pycache__/url.cpython-38.pyc 100644 /usr/lib/python3/site-packages/atom/auth.py 100644 @@ -59,41 +59,41 @@ /usr/lib/python3/site-packages/gdata 40755 -/usr/lib/python3/site-packages/gdata-2.0.18-py3.7.egg-info 100644 +/usr/lib/python3/site-packages/gdata-2.0.18-py3.8.egg-info 100644 /usr/lib/python3/site-packages/gdata/__init__.py 100644 /usr/lib/python3/site-packages/gdata/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/apps_property.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/apps_property.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/apps_property.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/auth.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/auth.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/auth.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/client.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/client.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/client.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/core.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/core.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/core.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/data.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/gauth.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/gauth.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/gauth.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/sample_util.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/sample_util.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/sample_util.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/service.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/service.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/service.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/test_config.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/test_config.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/test_config.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/test_data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/test_data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/test_data.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/urlfetch.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/urlfetch.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/__pycache__/urlfetch.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/apps_property.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/apps_property.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/apps_property.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/auth.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/auth.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/auth.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/client.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/client.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/client.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/core.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/core.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/core.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/data.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/gauth.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/gauth.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/gauth.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/sample_util.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/sample_util.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/sample_util.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/service.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/service.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/service.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/test_config.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/test_config.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/test_config.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/test_data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/test_data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/test_data.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/urlfetch.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/urlfetch.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/__pycache__/urlfetch.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/acl 40755 @@ -101,8 +101,8 @@ /usr/lib/python3/site-packages/gdata/acl/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/acl/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/acl/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/acl/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/acl/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/acl/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/acl/__pycache__/data.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/acl/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/acl/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/acl/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/acl/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/acl/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/acl/__pycache__/data.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/acl/data.py 100644 @@ -111,11 +111,11 @@ /usr/lib/python3/site-packages/gdata/alt/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/alt/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/alt/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/alt/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/alt/__pycache__/app_engine.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/alt/__pycache__/app_engine.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/alt/__pycache__/app_engine.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/alt/__pycache__/appengine.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/alt/__pycache__/appengine.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/alt/__pycache__/appengine.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/alt/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/alt/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/alt/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/alt/__pycache__/app_engine.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/alt/__pycache__/app_engine.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/alt/__pycache__/app_engine.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/alt/__pycache__/appengine.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/alt/__pycache__/appengine.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/alt/__pycache__/appengine.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/alt/app_engine.py 100644 @@ -125,14 +125,14 @@ /usr/lib/python3/site-packages/gdata/analytics/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/analytics/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/analytics/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/analytics/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/analytics/__pycache__/client.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/analytics/__pycache__/client.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/analytics/__pycache__/client.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/analytics/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/analytics/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/analytics/__pycache__/data.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/analytics/__pycache__/service.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/analytics/__pycache__/service.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/analytics/__pycache__/service.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/analytics/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/analytics/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/analytics/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/analytics/__pycache__/client.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/analytics/__pycache__/client.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/analytics/__pycache__/client.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/analytics/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/analytics/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/analytics/__pycache__/data.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/analytics/__pycache__/service.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/analytics/__pycache__/service.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/analytics/__pycache__/service.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/analytics/client.py 100644 @@ -143,17 +143,17 @@ /usr/lib/python3/site-packages/gdata/apps/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/apps/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/__pycache__/apps_property_entry.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/__pycache__/apps_property_entry.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/__pycache__/apps_property_entry.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/__pycache__/client.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/__pycache__/client.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/__pycache__/client.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/__pycache__/data.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/__pycache__/service.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/__pycache__/service.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/__pycache__/service.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/__pycache__/apps_property_entry.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/__pycache__/apps_property_entry.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/__pycache__/apps_property_entry.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/__pycache__/client.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/__pycache__/client.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/__pycache__/client.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/__pycache__/data.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/__pycache__/service.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/__pycache__/service.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/__pycache__/service.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/apps/adminsettings 40755 @@ -161,8 +161,8 @@ /usr/lib/python3/site-packages/gdata/apps/adminsettings/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/apps/adminsettings/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/adminsettings/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/adminsettings/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/adminsettings/__pycache__/service.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/adminsettings/__pycache__/service.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/adminsettings/__pycache__/service.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/adminsettings/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/adminsettings/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/adminsettings/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/adminsettings/__pycache__/service.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/adminsettings/__pycache__/service.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/adminsettings/__pycache__/service.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/apps/adminsettings/service.py 100644 @@ -172,8 +172,8 @@ /usr/lib/python3/site-packages/gdata/apps/audit/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/apps/audit/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/audit/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/audit/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/audit/__pycache__/service.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/audit/__pycache__/service.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/audit/__pycache__/service.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/audit/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/audit/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/audit/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/audit/__pycache__/service.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/audit/__pycache__/service.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/audit/__pycache__/service.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/apps/audit/service.py 100644 @@ -184,14 +184,14 @@ /usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/client.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/client.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/client.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/data.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/service.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/service.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/service.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/client.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/client.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/client.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/data.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/service.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/service.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/emailsettings/__pycache__/service.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/apps/emailsettings/client.py 100644 @@ -202,14 +202,14 @@ /usr/lib/python3/site-packages/gdata/apps/groups/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/client.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/client.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/client.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/data.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/service.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/service.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/service.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/client.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/client.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/client.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/data.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/service.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/service.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/groups/__pycache__/service.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/apps/groups/client.py 100644 @@ -220,8 +220,8 @@ /usr/lib/python3/site-packages/gdata/apps/migration/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/apps/migration/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/migration/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/migration/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/migration/__pycache__/service.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/migration/__pycache__/service.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/migration/__pycache__/service.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/migration/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/migration/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/migration/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/migration/__pycache__/service.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/migration/__pycache__/service.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/migration/__pycache__/service.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/apps/migration/service.py 100644 @@ -230,11 +230,11 @@ /usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/client.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/client.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/client.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/data.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/client.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/client.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/client.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/multidomain/__pycache__/data.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/apps/multidomain/client.py 100644 @@ -244,14 +244,14 @@ /usr/lib/python3/site-packages/gdata/apps/organization/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/client.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/client.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/client.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/data.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/service.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/service.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/service.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/client.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/client.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/client.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/data.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/service.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/service.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/apps/organization/__pycache__/service.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/apps/organization/client.py 100644 @@ -265,14 +265,14 @@ /usr/lib/python3/site-packages/gdata/blogger/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/blogger/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/blogger/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/blogger/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/blogger/__pycache__/client.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/blogger/__pycache__/client.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/blogger/__pycache__/client.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/blogger/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/blogger/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/blogger/__pycache__/data.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/blogger/__pycache__/service.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/blogger/__pycache__/service.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/blogger/__pycache__/service.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/blogger/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/blogger/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/blogger/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/blogger/__pycache__/client.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/blogger/__pycache__/client.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/blogger/__pycache__/client.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/blogger/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/blogger/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/blogger/__pycache__/data.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/blogger/__pycache__/service.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/blogger/__pycache__/service.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/blogger/__pycache__/service.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/blogger/client.py 100644 @@ -283,14 +283,14 @@ /usr/lib/python3/site-packages/gdata/calendar/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/calendar/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/calendar/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/calendar/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/calendar/__pycache__/client.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/calendar/__pycache__/client.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/calendar/__pycache__/client.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/calendar/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/calendar/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/calendar/__pycache__/data.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/calendar/__pycache__/service.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/calendar/__pycache__/service.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/calendar/__pycache__/service.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/calendar/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/calendar/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/calendar/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/calendar/__pycache__/client.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/calendar/__pycache__/client.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/calendar/__pycache__/client.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/calendar/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/calendar/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/calendar/__pycache__/data.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/calendar/__pycache__/service.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/calendar/__pycache__/service.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/calendar/__pycache__/service.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/calendar/client.py 100644 @@ -301,11 +301,11 @@ /usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/client.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/client.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/client.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/data.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/client.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/client.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/client.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/calendar_resource/__pycache__/data.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/calendar_resource/client.py 100644 @@ -316,8 +316,8 @@ /usr/lib/python3/site-packages/gdata/codesearch/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/codesearch/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/codesearch/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/codesearch/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/codesearch/__pycache__/service.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/codesearch/__pycache__/service.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/codesearch/__pycache__/service.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/codesearch/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/codesearch/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/codesearch/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/codesearch/__pycache__/service.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/codesearch/__pycache__/service.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/codesearch/__pycache__/service.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/codesearch/service.py 100644 @@ -326,14 +326,14 @@ /usr/lib/python3/site-packages/gdata/contacts/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/contacts/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/contacts/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/contacts/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/contacts/__pycache__/client.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/contacts/__pycache__/client.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/contacts/__pycache__/client.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/contacts/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/contacts/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/contacts/__pycache__/data.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/contacts/__pycache__/service.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/contacts/__pycache__/service.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/contacts/__pycache__/service.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/contacts/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/contacts/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/contacts/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/contacts/__pycache__/client.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/contacts/__pycache__/client.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/contacts/__pycache__/client.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/contacts/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/contacts/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/contacts/__pycache__/data.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/contacts/__pycache__/service.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/contacts/__pycache__/service.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/contacts/__pycache__/service.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/contacts/client.py 100644 @@ -344,11 +344,11 @@ /usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/client.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/client.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/client.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/data.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/client.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/client.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/client.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/contentforshopping/__pycache__/data.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/contentforshopping/client.py 100644 @@ -360,14 +360,14 @@ /usr/lib/python3/site-packages/gdata/docs/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/docs/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/docs/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/docs/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/docs/__pycache__/client.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/docs/__pycache__/client.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/docs/__pycache__/client.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/docs/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/docs/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/docs/__pycache__/data.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/docs/__pycache__/service.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/docs/__pycache__/service.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/docs/__pycache__/service.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/docs/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/docs/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/docs/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/docs/__pycache__/client.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/docs/__pycache__/client.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/docs/__pycache__/client.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/docs/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/docs/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/docs/__pycache__/data.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/docs/__pycache__/service.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/docs/__pycache__/service.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/docs/__pycache__/service.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/docs/client.py 100644 @@ -378,8 +378,8 @@ /usr/lib/python3/site-packages/gdata/dublincore/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/dublincore/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/dublincore/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/dublincore/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/dublincore/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/dublincore/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/dublincore/__pycache__/data.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/dublincore/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/dublincore/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/dublincore/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/dublincore/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/dublincore/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/dublincore/__pycache__/data.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/dublincore/data.py 100644 @@ -388,5 +388,5 @@ /usr/lib/python3/site-packages/gdata/exif/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/exif/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/exif/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/exif/__pycache__/__init__.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/exif/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/exif/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/exif/__pycache__/__init__.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/finance 40755 @@ -394,11 +394,11 @@ /usr/lib/python3/site-packages/gdata/finance/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/finance/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/finance/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/finance/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/finance/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/finance/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/finance/__pycache__/data.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/finance/__pycache__/service.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/finance/__pycache__/service.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/finance/__pycache__/service.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/finance/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/finance/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/finance/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/finance/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/finance/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/finance/__pycache__/data.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/finance/__pycache__/service.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/finance/__pycache__/service.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/finance/__pycache__/service.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/finance/data.py 100644 @@ -409,8 +409,8 @@ /usr/lib/python3/site-packages/gdata/geo/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/geo/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/geo/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/geo/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/geo/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/geo/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/geo/__pycache__/data.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/geo/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/geo/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/geo/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/geo/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/geo/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/geo/__pycache__/data.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/geo/data.py 100644 @@ -419,8 +419,8 @@ /usr/lib/python3/site-packages/gdata/media/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/media/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/media/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/media/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/media/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/media/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/media/__pycache__/data.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/media/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/media/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/media/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/media/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/media/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/media/__pycache__/data.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/media/data.py 100644 @@ -429,8 +429,8 @@ /usr/lib/python3/site-packages/gdata/oauth/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/oauth/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/oauth/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/oauth/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/oauth/__pycache__/rsa.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/oauth/__pycache__/rsa.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/oauth/__pycache__/rsa.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/oauth/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/oauth/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/oauth/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/oauth/__pycache__/rsa.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/oauth/__pycache__/rsa.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/oauth/__pycache__/rsa.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/oauth/rsa.py 100644 @@ -439,8 +439,8 @@ /usr/lib/python3/site-packages/gdata/opensearch/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/opensearch/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/opensearch/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/opensearch/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/opensearch/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/opensearch/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/opensearch/__pycache__/data.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/opensearch/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/opensearch/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/opensearch/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/opensearch/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/opensearch/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/opensearch/__pycache__/data.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/opensearch/data.py 100644 @@ -449,8 +449,8 @@ /usr/lib/python3/site-packages/gdata/photos/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/photos/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/photos/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/photos/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/photos/__pycache__/service.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/photos/__pycache__/service.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/photos/__pycache__/service.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/photos/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/photos/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/photos/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/photos/__pycache__/service.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/photos/__pycache__/service.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/photos/__pycache__/service.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/photos/service.py 100644 @@ -459,11 +459,11 @@ /usr/lib/python3/site-packages/gdata/projecthosting/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/client.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/client.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/client.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/data.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/client.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/client.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/client.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/projecthosting/__pycache__/data.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/projecthosting/client.py 100644 @@ -475,11 +475,11 @@ /usr/lib/python3/site-packages/gdata/sites/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/sites/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/sites/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/sites/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/sites/__pycache__/client.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/sites/__pycache__/client.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/sites/__pycache__/client.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/sites/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/sites/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/sites/__pycache__/data.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/sites/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/sites/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/sites/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/sites/__pycache__/client.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/sites/__pycache__/client.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/sites/__pycache__/client.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/sites/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/sites/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/sites/__pycache__/data.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/sites/client.py 100644 @@ -489,11 +489,11 @@ /usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/service.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/service.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/service.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/text_db.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/text_db.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/text_db.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/service.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/service.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/service.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/text_db.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/text_db.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/spreadsheet/__pycache__/text_db.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/spreadsheet/service.py 100644 @@ -503,11 +503,11 @@ /usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/client.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/client.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/client.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/data.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/client.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/client.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/client.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/spreadsheets/__pycache__/data.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/spreadsheets/client.py 100644 @@ -520,11 +520,11 @@ /usr/lib/python3/site-packages/gdata/webmastertools/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/data.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/service.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/service.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/service.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/data.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/service.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/service.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/webmastertools/__pycache__/service.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/webmastertools/data.py 100644 @@ -534,14 +534,14 @@ /usr/lib/python3/site-packages/gdata/youtube/__pycache__ 40755 -/usr/lib/python3/site-packages/gdata/youtube/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/youtube/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/youtube/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/youtube/__pycache__/client.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/youtube/__pycache__/client.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/youtube/__pycache__/client.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/youtube/__pycache__/data.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/youtube/__pycache__/data.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/youtube/__pycache__/data.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/gdata/youtube/__pycache__/service.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/gdata/youtube/__pycache__/service.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/gdata/youtube/__pycache__/service.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/gdata/youtube/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/youtube/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/youtube/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/youtube/__pycache__/client.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/youtube/__pycache__/client.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/youtube/__pycache__/client.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/youtube/__pycache__/data.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/youtube/__pycache__/data.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/youtube/__pycache__/data.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/gdata/youtube/__pycache__/service.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/gdata/youtube/__pycache__/service.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/gdata/youtube/__pycache__/service.cpython-38.pyc 100644 /usr/lib/python3/site-packages/gdata/youtube/client.py 100644