diff --git a/README.md b/README.md index c4bc7e50..4b9ab18e 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ For an overview of some application concepts see the [wiki page](https://github. ## Installation -You will need Python 2.7 or 3.5+. +You will need Python 3.12 or newer. To install dependencies and the codespeed Django app: diff --git a/codespeed/admin.py b/codespeed/admin.py index 0e29c639..610fef13 100644 --- a/codespeed/admin.py +++ b/codespeed/admin.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from django import forms from django.contrib import admin diff --git a/codespeed/commits/exceptions.py b/codespeed/commits/exceptions.py index 7b27cc2f..862241e0 100644 --- a/codespeed/commits/exceptions.py +++ b/codespeed/commits/exceptions.py @@ -1,6 +1,2 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import, unicode_literals - - class CommitLogError(Exception): """An error when trying to display commit log messages""" diff --git a/codespeed/commits/github.py b/codespeed/commits/github.py index 820b1367..9386bc3b 100644 --- a/codespeed/commits/github.py +++ b/codespeed/commits/github.py @@ -1,21 +1,12 @@ -# encoding: utf-8 """ Specialized Git backend which uses Github.com for all of the heavy work Among other things, this means that the codespeed server doesn't need to have git installed, the ability to write files, etc. """ -from __future__ import absolute_import import logging -try: - # Python 3 - from urllib.request import urlopen - from urllib.request import Request -except ImportError: - # Python 2 - from urllib2 import urlopen - from urllib2 import Request +from urllib.request import urlopen, Request import re import json diff --git a/codespeed/commits/logs.py b/codespeed/commits/logs.py index 2869ad72..e9a46c7d 100644 --- a/codespeed/commits/logs.py +++ b/codespeed/commits/logs.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import, unicode_literals - import datetime import logging diff --git a/codespeed/commits/mercurial.py b/codespeed/commits/mercurial.py index 636af365..629d596c 100644 --- a/codespeed/commits/mercurial.py +++ b/codespeed/commits/mercurial.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import - import os import datetime from subprocess import Popen, PIPE diff --git a/codespeed/commits/subversion.py b/codespeed/commits/subversion.py index 2ace60fd..bacc8602 100644 --- a/codespeed/commits/subversion.py +++ b/codespeed/commits/subversion.py @@ -1,6 +1,4 @@ -# -*- coding: utf-8 -*- """Subversion commit logs support""" -from __future__ import absolute_import from datetime import datetime diff --git a/codespeed/migrations/0001_initial.py b/codespeed/migrations/0001_initial.py index 1a0c95aa..6604652d 100644 --- a/codespeed/migrations/0001_initial.py +++ b/codespeed/migrations/0001_initial.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - from django.db import migrations, models diff --git a/codespeed/migrations/0002_median.py b/codespeed/migrations/0002_median.py index 1f1a6f44..6d33eb3f 100644 --- a/codespeed/migrations/0002_median.py +++ b/codespeed/migrations/0002_median.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - from django.db import migrations, models diff --git a/codespeed/migrations/0003_project_default_branch.py b/codespeed/migrations/0003_project_default_branch.py index 0ff8e23e..a9a8c1b3 100644 --- a/codespeed/migrations/0003_project_default_branch.py +++ b/codespeed/migrations/0003_project_default_branch.py @@ -1,6 +1,4 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.9.13 on 2017-08-04 03:45 -from __future__ import unicode_literals from django.db import migrations, models diff --git a/codespeed/models.py b/codespeed/models.py index a3ae267d..bfb3430f 100644 --- a/codespeed/models.py +++ b/codespeed/models.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import, unicode_literals - import logging import os import json @@ -238,7 +235,7 @@ class Result(models.Model): Environment, on_delete=models.CASCADE, related_name="results") def __str__(self): - return u"%s: %s" % (self.benchmark.name, self.value) + return "%s: %s" % (self.benchmark.name, self.value) class Meta: unique_together = ("revision", "executable", "benchmark", "environment") @@ -256,7 +253,7 @@ class Report(models.Model): _tablecache = models.TextField(blank=True) def __str__(self): - return u"Report for %s" % self.revision + return "Report for %s" % self.revision class Meta: unique_together = ("revision", "executable", "environment") @@ -364,7 +361,7 @@ def updown(self, val): direction = val >= 0 and "up" or "down" aval = abs(val) if aval == float("inf"): - return u"%s ∞%%" % direction + return "%s ∞%%" % direction else: return "%s %.1f%%" % (direction, aval) diff --git a/codespeed/results.py b/codespeed/results.py index ff1e3d2b..6943e29c 100644 --- a/codespeed/results.py +++ b/codespeed/results.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import - import logging from django.core.exceptions import ValidationError diff --git a/codespeed/settings.py b/codespeed/settings.py index 5290a15e..7e5ea9e4 100644 --- a/codespeed/settings.py +++ b/codespeed/settings.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Default settings for Codespeed""" ## General default options ## diff --git a/codespeed/templatetags/percentages.py b/codespeed/templatetags/percentages.py index 33739432..1404ea9e 100644 --- a/codespeed/templatetags/percentages.py +++ b/codespeed/templatetags/percentages.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from django import template register = template.Library() diff --git a/codespeed/tests/test_auth.py b/codespeed/tests/test_auth.py index bc2b356b..5d6e7828 100644 --- a/codespeed/tests/test_auth.py +++ b/codespeed/tests/test_auth.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from unittest import mock from django.test import TestCase, override_settings diff --git a/codespeed/tests/test_models.py b/codespeed/tests/test_models.py index df4283d0..a377b644 100644 --- a/codespeed/tests/test_models.py +++ b/codespeed/tests/test_models.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import os from django.conf import settings diff --git a/codespeed/tests/test_views.py b/codespeed/tests/test_views.py index 367d2b87..49331403 100644 --- a/codespeed/tests/test_views.py +++ b/codespeed/tests/test_views.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from datetime import datetime, timedelta import copy import json @@ -374,7 +373,7 @@ def test_gettimelinedata(self): "There are 2 datapoints") self.assertEqual( responsedata['timelines'][0]['branches']['master']['1'][1], - [u'2011/04/13 17:04:22 +0000', 2000.0, 1.11111, u'2', u'', u'master']) + ['2011/04/13 17:04:22 +0000', 2000.0, 1.11111, '2', '', 'master']) @override_settings(ALLOW_ANONYMOUS_POST=True) diff --git a/codespeed/tests/test_views_data.py b/codespeed/tests/test_views_data.py index 3bc5f6c7..10760a66 100644 --- a/codespeed/tests/test_views_data.py +++ b/codespeed/tests/test_views_data.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from django.test import TestCase from django.test import override_settings diff --git a/codespeed/urls.py b/codespeed/urls.py index e8976a45..18d6c9d7 100644 --- a/codespeed/urls.py +++ b/codespeed/urls.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from django.urls import re_path from django.views.generic import TemplateView diff --git a/codespeed/views.py b/codespeed/views.py index 3fba5c99..849f424a 100644 --- a/codespeed/views.py +++ b/codespeed/views.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import, unicode_literals - import json import logging diff --git a/codespeed/views_data.py b/codespeed/views_data.py index 583f5457..c225d473 100644 --- a/codespeed/views_data.py +++ b/codespeed/views_data.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import - from django.conf import settings from django.core.exceptions import ObjectDoesNotExist from django.shortcuts import get_object_or_404 diff --git a/sample_project/client.py b/sample_project/client.py index 58c3e9ab..926790db 100644 --- a/sample_project/client.py +++ b/sample_project/client.py @@ -1,10 +1,8 @@ -# encoding: utf-8 - -from urlparse import urljoin import logging import platform -import urllib import sys +from urllib.parse import urlencode, urljoin +from urllib.request import urlopen def save_to_speedcenter(url=None, project=None, commitid=None, executable=None, @@ -57,7 +55,7 @@ def save_to_speedcenter(url=None, project=None, commitid=None, executable=None, if not data.get('environment', None): data['environment'] = platform.platform(aliased=True) - f = urllib.urlopen(url, urllib.urlencode(data)) + f = urlopen(url, urlencode(data).encode()) response = f.read() status = f.getcode() @@ -117,6 +115,6 @@ def save_to_speedcenter(url=None, project=None, commitid=None, executable=None, try: save_to_speedcenter(**kwargs) sys.exit(0) - except StandardError as e: + except Exception as e: logging.error("Error saving results: %s", e) sys.exit(1) diff --git a/sample_project/settings.py b/sample_project/settings.py index 929d5577..cad3c1c0 100644 --- a/sample_project/settings.py +++ b/sample_project/settings.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Django settings for a Codespeed project. import os diff --git a/sample_project/urls.py b/sample_project/urls.py index a06d619f..19f26201 100644 --- a/sample_project/urls.py +++ b/sample_project/urls.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from django.conf import settings from django.urls import include, re_path from django.contrib import admin diff --git a/setup.py b/setup.py index 77168e04..c5ac642c 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,8 @@ download_url="https://github.com/tobami/codespeed/tags", license='GNU Lesser General Public License version 2.1', keywords=['benchmarking', 'visualization'], - install_requires=[ 'django', 'isodate', 'matplotlib'], + python_requires='>=3.12', + install_requires=['django>=5.2,<7', 'isodate', 'matplotlib'], packages=find_packages(exclude=['ez_setup', 'sample_project', 'speed_python']), setup_requires=['setuptools-markdown'], long_description_markdown_filename='README.md', @@ -23,12 +24,11 @@ 'License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)', 'Operating System :: OS Independent', 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3 :: Only', + 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', + 'Programming Language :: Python :: 3.14', 'Topic :: Internet :: WWW/HTTP :: WSGI :: Application', ] ) diff --git a/speed_python/client.py b/speed_python/client.py index d5b50eb1..926790db 100644 --- a/speed_python/client.py +++ b/speed_python/client.py @@ -1,10 +1,8 @@ -# encoding: utf-8 - -from urlparse import urljoin import logging import platform -import urllib import sys +from urllib.parse import urlencode, urljoin +from urllib.request import urlopen def save_to_speedcenter(url=None, project=None, commitid=None, executable=None, @@ -57,7 +55,7 @@ def save_to_speedcenter(url=None, project=None, commitid=None, executable=None, if not data.get('environment', None): data['environment'] = platform.platform(aliased=True) - f = urllib.urlopen(url, urllib.urlencode(data)) + f = urlopen(url, urlencode(data).encode()) response = f.read() status = f.getcode() @@ -117,6 +115,6 @@ def save_to_speedcenter(url=None, project=None, commitid=None, executable=None, try: save_to_speedcenter(**kwargs) sys.exit(0) - except StandardError, e: + except Exception as e: logging.error("Error saving results: %s", e) sys.exit(1) diff --git a/speed_python/generate_secret.py b/speed_python/generate_secret.py index 5e2b53e7..3e639cfd 100755 --- a/speed_python/generate_secret.py +++ b/speed_python/generate_secret.py @@ -1,7 +1,5 @@ #!/usr/bin/env python -from __future__ import print_function - import os from django.utils.crypto import get_random_string diff --git a/speed_python/settings.py b/speed_python/settings.py index 45ff6043..63fe0dd4 100644 --- a/speed_python/settings.py +++ b/speed_python/settings.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Django settings for a Codespeed project. import os diff --git a/speed_python/urls.py b/speed_python/urls.py index 8f93d468..3bb63bb9 100644 --- a/speed_python/urls.py +++ b/speed_python/urls.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - import os.path from django.conf import settings diff --git a/tools/create_trunks.py b/tools/create_trunks.py index 5514e3b9..59d10eed 100644 --- a/tools/create_trunks.py +++ b/tools/create_trunks.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ Create the default branch for all existing projects Starting v 0.8.0 that is mandatory. @@ -49,7 +48,7 @@ def main(): if not proj.branches.filter(name='default'): trunk = Branch(name='default', project=proj) trunk.save() - print "Created branch 'default' for project {0}".format(proj) + print("Created branch 'default' for project {0}".format(proj)) if __name__ == '__main__': diff --git a/tools/migrate_script.py b/tools/migrate_script.py index e87379e9..8ea5a736 100644 --- a/tools/migrate_script.py +++ b/tools/migrate_script.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Adds the default branch to all existing revisions Note: This file is assumed to be in the same directory diff --git a/tools/pypy/import_from_json.py b/tools/pypy/import_from_json.py index 5d3eb21d..a3240901 100644 --- a/tools/pypy/import_from_json.py +++ b/tools/pypy/import_from_json.py @@ -1,8 +1,10 @@ -# -*- coding: utf-8 -*- ################################################################################ # This script imports PyPy's result data from json files located on the server # ################################################################################ -import simplejson, urllib2 +import json +import urllib.error +import urllib.parse +import urllib.request import sys from xml.dom.minidom import parse from datetime import datetime @@ -21,7 +23,7 @@ # get json filenames filelist = [] try: - datasource = urllib2.urlopen(RESULTS_URL) + datasource = urllib.request.urlopen(RESULTS_URL) dom = parse(datasource) for elem in dom.getElementsByTagName('td'): for e in elem.childNodes: @@ -31,7 +33,7 @@ if int(filename.replace(".json", "")) >= START_REV and\ int(filename.replace(".json", "")) <= END_REV: filelist.append(filename) - except urllib2.URLError, e: + except urllib.error.URLError as e: response = "None" if hasattr(e, 'reason'): response = '\n We failed to reach ' + RESULTS_URL + '\n' @@ -39,16 +41,16 @@ elif hasattr(e, 'code'): response = '\n The server couldn\'t fulfill the request\n' response += ' Error code: ' + str(e) - print "Results Server (%s) response: %s\n" % (RESULTS_URL, response) + print("Results Server (%s) response: %s\n" % (RESULTS_URL, response)) sys.exit(1) finally: datasource.close() # read json result and save to speed.pypy.org for filename in filelist: - print "Reading %s..." % filename - f = urllib2.urlopen(RESULTS_URL + filename) - result = simplejson.load(f) + print("Reading %s..." % filename) + f = urllib.request.urlopen(RESULTS_URL + filename) + result = json.load(f) f.close() proj = PROJECT revision = result['revision'] @@ -62,4 +64,4 @@ #saveresults.save(proj, revision, result['results'], options, interpreter, host) if filename == filelist[len(filelist)-1]: savecpython.save('cpython', '100', result['results'], options, 'cpython', host) -print "\nOK" +print("\nOK") diff --git a/tools/pypy/savecpython.py b/tools/pypy/savecpython.py index c5200947..799600f9 100644 --- a/tools/pypy/savecpython.py +++ b/tools/pypy/savecpython.py @@ -1,5 +1,6 @@ -# -*- coding: utf-8 -*- -import urllib, urllib2 +import urllib.error +import urllib.parse +import urllib.request from datetime import datetime SPEEDURL = 'http://127.0.0.1:8000/' @@ -21,7 +22,7 @@ def save(project, revision, results, options, executable, host, testing=False): elif res_type == "ComparisonResult": value = results['avg_base'] else: - print("ERROR: result type unknown " + b[1]) + print(("ERROR: result type unknown " + b[1])) return 1 data = { 'commitid': revision, @@ -41,23 +42,23 @@ def save(project, revision, results, options, executable, host, testing=False): def send(data): #save results - params = urllib.urlencode(data) + params = urllib.parse.urlencode(data) f = None response = "None" info = str(datetime.today()) + ": Saving result for " + data['executable'] + " revision " info += str(data['commitid']) + ", benchmark " + data['benchmark'] print(info) try: - f = urllib2.urlopen(SPEEDURL + 'result/add/', params) + f = urllib.request.urlopen(SPEEDURL + 'result/add/', params.encode()) response = f.read() f.close() - except urllib2.URLError, e: + except urllib.error.URLError as e: if hasattr(e, 'reason'): response = '\n We failed to reach a server\n' response += ' Reason: ' + str(e.reason) elif hasattr(e, 'code'): response = '\n The server couldn\'t fulfill the request\n' response += ' Error code: ' + str(e) - print("Server (%s) response: %s\n" % (SPEEDURL, response)) + print(("Server (%s) response: %s\n" % (SPEEDURL, response))) return 1 return 0 diff --git a/tools/pypy/saveresults.py b/tools/pypy/saveresults.py index 8ca8ee75..31ba969d 100644 --- a/tools/pypy/saveresults.py +++ b/tools/pypy/saveresults.py @@ -1,9 +1,10 @@ -# -*- coding: utf-8 -*- ####################################################### # This script saves result data # # It expects the format of unladen swallow's perf.py # ####################################################### -import urllib, urllib2 +import urllib.error +import urllib.parse +import urllib.request from datetime import datetime #SPEEDURL = 'http://127.0.0.1:8000/' @@ -24,7 +25,7 @@ def save(project, revision, results, options, executable, environment, testing=F elif res_type == "ComparisonResult": value = results['avg_changed'] else: - print("ERROR: result type unknown " + b[1]) + print(("ERROR: result type unknown " + b[1])) return 1 data = { 'commitid': revision, @@ -43,7 +44,7 @@ def save(project, revision, results, options, executable, environment, testing=F def send(data): #save results - params = urllib.urlencode(data) + params = urllib.parse.urlencode(data) f = None response = "None" info = str(datetime.today()) + ": Saving result for " + data['executable'] @@ -51,16 +52,16 @@ def send(data): info += data['benchmark'] print(info) try: - f = urllib2.urlopen(SPEEDURL + 'result/add/', params) + f = urllib.request.urlopen(SPEEDURL + 'result/add/', params.encode()) response = f.read() f.close() - except urllib2.URLError as e: + except urllib.error.URLError as e: if hasattr(e, 'reason'): response = '\n We failed to reach a server\n' response += ' Reason: ' + str(e.reason) elif hasattr(e, 'code'): response = '\n The server couldn\'t fulfill the request\n' response += ' Error code: ' + str(e) - print("Server (%s) response: %s\n" % (SPEEDURL, response)) + print(("Server (%s) response: %s\n" % (SPEEDURL, response))) return 1 return 0 diff --git a/tools/pypy/test_saveresults.py b/tools/pypy/test_saveresults.py index b84f3b28..94cf166e 100644 --- a/tools/pypy/test_saveresults.py +++ b/tools/pypy/test_saveresults.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import saveresults import unittest diff --git a/tools/save_multiple_results.py b/tools/save_multiple_results.py index bc262e1a..48c2ea2e 100644 --- a/tools/save_multiple_results.py +++ b/tools/save_multiple_results.py @@ -1,9 +1,9 @@ -# -*- coding: utf-8 -*- #################################################### # Sample script that shows how to save result data using json # #################################################### -import urllib -import urllib2 +import urllib.error +import urllib.parse +import urllib.request import json @@ -36,15 +36,16 @@ def add(data): #params = urllib.urlencode(data) response = "None" try: - f = urllib2.urlopen( - CODESPEED_URL + 'result/add/json/', urllib.urlencode(data)) - except urllib2.HTTPError as e: - print str(e) - print e.read() + f = urllib.request.urlopen( + CODESPEED_URL + 'result/add/json/', + urllib.parse.urlencode(data).encode()) + except urllib.error.HTTPError as e: + print(str(e)) + print(e.read()) return response = f.read() f.close() - print "Server (%s) response: %s\n" % (CODESPEED_URL, response) + print("Server (%s) response: %s\n" % (CODESPEED_URL, response)) if __name__ == "__main__": diff --git a/tools/save_single_result.py b/tools/save_single_result.py index 830858e7..70373ea2 100644 --- a/tools/save_single_result.py +++ b/tools/save_single_result.py @@ -1,10 +1,10 @@ -# -*- coding: utf-8 -*- #################################################### # Sample script that shows how to save result data # #################################################### from datetime import datetime -import urllib -import urllib2 +import urllib.error +import urllib.parse +import urllib.request # You need to enter the real URL and have the server running CODESPEED_URL = 'http://localhost:8000/' @@ -34,19 +34,19 @@ def add(data): - params = urllib.urlencode(data) + params = urllib.parse.urlencode(data) response = "None" - print "Saving result for executable %s, revision %s, benchmark %s" % ( - data['executable'], data['commitid'], data['benchmark']) + print("Saving result for executable %s, revision %s, benchmark %s" % ( + data['executable'], data['commitid'], data['benchmark'])) try: - f = urllib2.urlopen(CODESPEED_URL + 'result/add/', params) - except urllib2.HTTPError as e: - print str(e) - print e.read() + f = urllib.request.urlopen(CODESPEED_URL + 'result/add/', params.encode()) + except urllib.error.HTTPError as e: + print(str(e)) + print(e.read()) return response = f.read() f.close() - print "Server (%s) response: %s\n" % (CODESPEED_URL, response) + print("Server (%s) response: %s\n" % (CODESPEED_URL, response)) if __name__ == "__main__": add(data) diff --git a/tools/test_performance.py b/tools/test_performance.py index 20408da4..fd4fabb6 100644 --- a/tools/test_performance.py +++ b/tools/test_performance.py @@ -1,5 +1,7 @@ import timeit -import urllib +import urllib.error +import urllib.parse +import urllib.request import sys @@ -16,12 +18,12 @@ def test_overview(): "executable": "1", "host": "bigdog", } - params = urllib.urlencode(data) - page = urllib.urlopen(SPEEDURL + 'overview/table/?' + params) + params = urllib.parse.urlencode(data) + page = urllib.request.urlopen(SPEEDURL + 'overview/table/?' + params) jsonstring = page.read() page.close() if not '' in jsonstring: - print "bad overview response" + print("bad overview response") sys.exit(1) @@ -33,30 +35,30 @@ def test_timeline(bench): "host": "bigdog", "revisions": 200 } - params = urllib.urlencode(data) - page = urllib.urlopen(SPEEDURL + 'timeline/json/?' + params) + params = urllib.parse.urlencode(data) + page = urllib.request.urlopen(SPEEDURL + 'timeline/json/?' + params) jsonstring = page.read() #print jsonstring page.close() if not '"lessisbetter": " (less is better)", "baseline":' in jsonstring \ or not', "error": "None"}' in jsonstring: - print "bad timeline response" + print("bad timeline response") sys.exit(1) if __name__ == "__main__": t = timeit.Timer('test_overview()', 'from __main__ import test_overview') results = t.repeat(20, 1) - print - print "OVERVIEW RESULTS" - print "min:", min(results) - print "avg:", sum(results) / len(results) - print - print "TIMELINE RESULTS" + print() + print("OVERVIEW RESULTS") + print("min:", min(results)) + print("avg:", sum(results) / len(results)) + print() + print("TIMELINE RESULTS") for bench in benchmarks: t = timeit.Timer('test_timeline("' + bench + '")', 'from __main__ import test_timeline') results = t.repeat(20, 1) - print "benchmark =", bench - print "min:", min(results) - print "avg:", sum(results) / len(results) - print + print("benchmark =", bench) + print("min:", min(results)) + print("avg:", sum(results) / len(results)) + print()