← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:remove-unused-utc into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:remove-unused-utc into launchpad:master.

Commit message:
Remove unused UTC variables

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/431819

I was looking into switching to `datetime.timezone.utc`, but we might as well start by removing some unused variables.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:remove-unused-utc into launchpad:master.
diff --git a/lib/lp/codehosting/scanner/bzrsync.py b/lib/lp/codehosting/scanner/bzrsync.py
index 08243fc..8ba1c48 100755
--- a/lib/lp/codehosting/scanner/bzrsync.py
+++ b/lib/lp/codehosting/scanner/bzrsync.py
@@ -14,7 +14,6 @@ __all__ = [
 
 import logging
 
-import pytz
 import transaction
 from breezy.graph import DictParentsProvider
 from breezy.revision import NULL_REVISION
@@ -35,8 +34,6 @@ from lp.translations.interfaces.translationtemplatesbuild import (
     ITranslationTemplatesBuildSource,
 )
 
-UTC = pytz.timezone("UTC")
-
 
 class BzrSync:
     """Import version control metadata from a Bazaar branch into the DB."""
diff --git a/lib/lp/services/twistedsupport/tests/test_loggingsupport.py b/lib/lp/services/twistedsupport/tests/test_loggingsupport.py
index 49b2a6b..a929f49 100644
--- a/lib/lp/services/twistedsupport/tests/test_loggingsupport.py
+++ b/lib/lp/services/twistedsupport/tests/test_loggingsupport.py
@@ -5,14 +5,11 @@
 
 import os
 
-import pytz
 from fixtures import TempDir
 
 from lp.services.twistedsupport.loggingsupport import LaunchpadLogFile
 from lp.testing import TestCase
 
-UTC = pytz.utc
-
 
 class TestLaunchpadLogFile(TestCase):
     def setUp(self):
diff --git a/lib/lp/services/webapp/adapter.py b/lib/lp/services/webapp/adapter.py
index b40eed7..a2585dd 100644
--- a/lib/lp/services/webapp/adapter.py
+++ b/lib/lp/services/webapp/adapter.py
@@ -12,7 +12,6 @@ from functools import partial
 from textwrap import dedent
 from time import time
 
-import pytz
 import transaction
 from lazr.restful.utils import get_current_browser_request
 from psycopg2.extensions import (
@@ -75,8 +74,6 @@ __all__ = [
 ]
 
 
-UTC = pytz.utc
-
 classImplements(TimeoutError, IRequestExpired)
 
 
diff --git a/lib/lp/services/webapp/errorlog.py b/lib/lp/services/webapp/errorlog.py
index 4da8578..9d98412 100644
--- a/lib/lp/services/webapp/errorlog.py
+++ b/lib/lp/services/webapp/errorlog.py
@@ -12,7 +12,6 @@ from urllib.parse import urlparse
 import oops.createhooks
 import oops_amqp
 import oops_timeline
-import pytz
 import six
 from lazr.restful.utils import get_current_browser_request
 from oops_datedir_repo import DateDirRepo
@@ -45,8 +44,6 @@ from lp.services.webapp.opstats import OpStats
 from lp.services.webapp.pgsession import PGSessionBase
 from lp.services.webapp.vhosts import allvhosts
 
-UTC = pytz.utc
-
 LAZR_OOPS_USER_REQUESTED_KEY = "lazr.oops.user_requested"
 
 
diff --git a/lib/lp/services/webapp/tests/test_errorlog.py b/lib/lp/services/webapp/tests/test_errorlog.py
index 9c1e2a9..6eb6caf 100644
--- a/lib/lp/services/webapp/tests/test_errorlog.py
+++ b/lib/lp/services/webapp/tests/test_errorlog.py
@@ -9,7 +9,6 @@ import traceback
 from textwrap import dedent
 
 import oops_amqp
-import pytz
 import testtools
 from fixtures import TempDir
 from lazr.batchnavigator.interfaces import InvalidBatchSizeError
@@ -40,8 +39,6 @@ from lp.services.webapp.interfaces import IUnloggedException, NoReferrerError
 from lp.testing import TestCaseWithFactory
 from lp.testing.layers import LaunchpadZopelessLayer
 
-UTC = pytz.utc
-
 
 class ArbitraryException(Exception):
     """Used to test handling of exceptions in OOPS reports."""
diff --git a/lib/lp/translations/browser/tests/translationmessage-views.rst b/lib/lp/translations/browser/tests/translationmessage-views.rst
index b9bb43a..b3f15c9 100644
--- a/lib/lp/translations/browser/tests/translationmessage-views.rst
+++ b/lib/lp/translations/browser/tests/translationmessage-views.rst
@@ -370,7 +370,6 @@ TranslationMessageSuggestions
 This class keeps all suggestions available for a concrete
 ITranslationMessage.
 
-    >>> import pytz
     >>> from zope.component import getUtility
     >>> from lp.translations.browser.translationmessage import (
     ...     TranslationMessageSuggestions,
@@ -414,7 +413,6 @@ We are going to work with a plural form message.
 Also, we are going to create a new translation for the Japanese
 language that will be used as the suggestion.
 
-    >>> UTC = pytz.timezone("UTC")
     >>> carlos = getUtility(IPersonSet).getByName("carlos")
     >>> login("carlos@xxxxxxxxxxxxx")
     >>> translation_message_ja = factory.makeCurrentTranslationMessage(
diff --git a/lib/lp/translations/doc/poimport-pofile-not-exported-from-rosetta.rst b/lib/lp/translations/doc/poimport-pofile-not-exported-from-rosetta.rst
index 806b5e7..a683b72 100644
--- a/lib/lp/translations/doc/poimport-pofile-not-exported-from-rosetta.rst
+++ b/lib/lp/translations/doc/poimport-pofile-not-exported-from-rosetta.rst
@@ -27,8 +27,6 @@ Here are some imports we need to get this test running.
     ...     ITranslationImportQueue,
     ... )
     >>> from lp.translations.model.potemplate import POTemplateSubset
-    >>> import pytz
-    >>> UTC = pytz.timezone("UTC")
     >>> translation_import_queue = getUtility(ITranslationImportQueue)
     >>> rosetta_experts = getUtility(ILaunchpadCelebrities).rosetta_experts
 
diff --git a/lib/lp/translations/doc/poimport-potemplate-syntax-error.rst b/lib/lp/translations/doc/poimport-potemplate-syntax-error.rst
index ac12003..c14673d 100644
--- a/lib/lp/translations/doc/poimport-potemplate-syntax-error.rst
+++ b/lib/lp/translations/doc/poimport-potemplate-syntax-error.rst
@@ -14,8 +14,6 @@ Here are some imports we need to get this test running.
     ...     ITranslationImportQueue,
     ... )
     >>> from lp.translations.model.potemplate import POTemplateSubset
-    >>> import pytz
-    >>> UTC = pytz.timezone("UTC")
     >>> translation_import_queue = getUtility(ITranslationImportQueue)
     >>> rosetta_experts = getUtility(ILaunchpadCelebrities).rosetta_experts
 
diff --git a/lib/lp/translations/doc/rosetta-translation.rst b/lib/lp/translations/doc/rosetta-translation.rst
index 3e993b5..90968fc 100644
--- a/lib/lp/translations/doc/rosetta-translation.rst
+++ b/lib/lp/translations/doc/rosetta-translation.rst
@@ -48,8 +48,6 @@ Get a person to create a translation with.
 
 Add a translation.
 
-    >>> import pytz
-    >>> UTC = pytz.timezone("UTC")
     >>> message = factory.makeCurrentTranslationMessage(
     ...     pofile, potmsgset, translations=translations, current_other=True
     ... )