XenoRyet has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/373930 )
Change subject: Use print function from __future__ ...................................................................... Use print function from __future__ To pass pyflakes in a future patch Bug: T121723 Change-Id: I13dec388d70dacd623c41923cc5e76018c081949 --- M fundraiser/analytics/functions.py M fundraiser/analytics/management/commands/AggregateBannerImpressions.py 2 files changed, 17 insertions(+), 13 deletions(-) Approvals: Mepps: Looks good to me, approved XenoRyet: Verified diff --git a/fundraiser/analytics/functions.py b/fundraiser/analytics/functions.py index fab03e3..dbcf6b9 100644 --- a/fundraiser/analytics/functions.py +++ b/fundraiser/analytics/functions.py @@ -1,3 +1,5 @@ +from __future__ import print_function + from datetime import timedelta from fundraiser.analytics.cache import cache @@ -25,13 +27,13 @@ if not country or country is None: if not default is False: if verbose: - print "** INVALID COUNTRY, returning default (%s)" % default + print("** INVALID COUNTRY, returning default (%s)" % default) return lookup_country(default, False, create, verbose) else: return None if len(country) > 2: if verbose: - print "** INVALID COUNTRY ISO_CODE %s --- USING DEFAULT" % country + print("** INVALID COUNTRY ISO_CODE %s --- USING DEFAULT" % country) country = default try: country = Country.objects.get(iso_code=country) @@ -44,7 +46,7 @@ Country.objects.create(iso_code=country) country = Country.objects.get(iso_code=country) if verbose and country: - print "** CREATED COUNTRY FOR: %s (id:%d)" % (country.iso_code, country.id) + print("** CREATED COUNTRY FOR: %s (id:%d)" % (country.iso_code, country.id)) return country else: return None @@ -77,13 +79,13 @@ if not language or language is None: if not default is False: if verbose: - print "** INVALID LANGUAGE, returning default (%s)" % default + print("** INVALID LANGUAGE, returning default (%s)" % default) return lookup_language(default, False, create, verbose) else: return None if len(language) > 24: if verbose: - print "** TRUNCATING LANGUAGE ISO_CODE %s to %s" % (language, language[:24]) + print("** TRUNCATING LANGUAGE ISO_CODE %s to %s" % (language, language[:24])) language = language[:24] try: language = Language.objects.get(iso_code=language) @@ -96,7 +98,7 @@ Language.objects.create(iso_code=language) language = Language.objects.get(iso_code=language) if verbose and language: - print "** CREATED LANGUAGE FOR: %s (id:%d)" % (language.iso_code, language.id) + print("** CREATED LANGUAGE FOR: %s (id:%d)" % (language.iso_code, language.id)) return language else: return None @@ -129,13 +131,13 @@ if not project or project is None: if not default is False: if verbose: - print "** INVALID PROJECT, returning default (%s)" % default + print("** INVALID PROJECT, returning default (%s)" % default) return lookup_project(default, False, create, verbose) else: return None if len(project) > 128: if verbose: - print "** TRUNCATING PROJECT %s to %s" % (project, project[:128]) + print("** TRUNCATING PROJECT %s to %s" % (project, project[:128])) project = project[:128] try: project = Project.objects.get(project=project) @@ -148,7 +150,7 @@ Project.objects.create(project=project) project = Project.objects.get(project=project) if verbose and project: - print "** CREATED PROJECT FOR: %s (id:%d)" % (project.project, project.id) + print("** CREATED PROJECT FOR: %s (id:%d)" % (project.project, project.id)) return project else: return None @@ -181,13 +183,13 @@ if not hostname or hostname is None: if not default is False: if verbose: - print "** INVALID SQUID HOSTNAME, returning default (%s)" % default + print("** INVALID SQUID HOSTNAME, returning default (%s)" % default) return lookup_squidhost(default, False, create, verbose) else: return None if len(hostname) > 128: if verbose: - print "** TRUNCATING SQUID HOSTNAME %s to %s" % (hostname, hostname[:128]) + print("** TRUNCATING SQUID HOSTNAME %s to %s" % (hostname, hostname[:128])) hostname = hostname[:128] try: squid = SquidHost.objects.get(hostname=hostname) @@ -200,7 +202,7 @@ SquidHost.objects.create(hostname=hostname) squid = SquidHost.objects.get(hostname=hostname) if verbose and squid: - print "** CREATED SQUID HOST FOR: %s (id:%d)" % (squid.hostname, squid.id) + print("** CREATED SQUID HOST FOR: %s (id:%d)" % (squid.hostname, squid.id)) return squid else: return None diff --git a/fundraiser/analytics/management/commands/AggregateBannerImpressions.py b/fundraiser/analytics/management/commands/AggregateBannerImpressions.py index 6e55159..00c5907 100644 --- a/fundraiser/analytics/management/commands/AggregateBannerImpressions.py +++ b/fundraiser/analytics/management/commands/AggregateBannerImpressions.py @@ -1,3 +1,5 @@ +from __future__ import print_function + from django.core.management.base import BaseCommand from django.db import connections, transaction @@ -119,7 +121,7 @@ endtime = datetime.now() - print "Aggregated %d rounds of %d each in %d.%d seconds" % (rounds, batch, (endtime - starttime).seconds, (endtime - starttime).microseconds) + print("Aggregated %d rounds of %d each in %d.%d seconds" % (rounds, batch, (endtime - starttime).seconds, (endtime - starttime).microseconds)) def run(self, batchSize=1000): -- To view, visit https://gerrit.wikimedia.org/r/373930 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I13dec388d70dacd623c41923cc5e76018c081949 Gerrit-PatchSet: 2 Gerrit-Project: wikimedia/fundraising/tools/DjangoBannerStats Gerrit-Branch: master Gerrit-Owner: Ejegg <ej...@ejegg.com> Gerrit-Reviewer: Mepps <me...@wikimedia.org> Gerrit-Reviewer: XenoRyet <dkozlow...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits