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

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 7c15ba8b9b85e95a7db0ac24f03a2766afb76fb3
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:remove-unused-utc
Merge into: launchpad:master
Diff against target: 162 lines (+0/-23)
9 files modified
lib/lp/codehosting/scanner/bzrsync.py (+0/-3)
lib/lp/services/twistedsupport/tests/test_loggingsupport.py (+0/-3)
lib/lp/services/webapp/adapter.py (+0/-3)
lib/lp/services/webapp/errorlog.py (+0/-3)
lib/lp/services/webapp/tests/test_errorlog.py (+0/-3)
lib/lp/translations/browser/tests/translationmessage-views.rst (+0/-2)
lib/lp/translations/doc/poimport-pofile-not-exported-from-rosetta.rst (+0/-2)
lib/lp/translations/doc/poimport-potemplate-syntax-error.rst (+0/-2)
lib/lp/translations/doc/rosetta-translation.rst (+0/-2)
Reviewer Review Type Date Requested Status
Andrey Fedoseev (community) Approve
Review via email: mp+431819@code.launchpad.net

Commit message

Remove unused UTC variables

Description of the change

I was looking into switching to `datetime.timezone.utc`, but we might as well start by removing some unused variables.

To post a comment you must log in.
Revision history for this message
Andrey Fedoseev (andrey-fedoseev) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/codehosting/scanner/bzrsync.py b/lib/lp/codehosting/scanner/bzrsync.py
2index 08243fc..8ba1c48 100755
3--- a/lib/lp/codehosting/scanner/bzrsync.py
4+++ b/lib/lp/codehosting/scanner/bzrsync.py
5@@ -14,7 +14,6 @@ __all__ = [
6
7 import logging
8
9-import pytz
10 import transaction
11 from breezy.graph import DictParentsProvider
12 from breezy.revision import NULL_REVISION
13@@ -35,8 +34,6 @@ from lp.translations.interfaces.translationtemplatesbuild import (
14 ITranslationTemplatesBuildSource,
15 )
16
17-UTC = pytz.timezone("UTC")
18-
19
20 class BzrSync:
21 """Import version control metadata from a Bazaar branch into the DB."""
22diff --git a/lib/lp/services/twistedsupport/tests/test_loggingsupport.py b/lib/lp/services/twistedsupport/tests/test_loggingsupport.py
23index 49b2a6b..a929f49 100644
24--- a/lib/lp/services/twistedsupport/tests/test_loggingsupport.py
25+++ b/lib/lp/services/twistedsupport/tests/test_loggingsupport.py
26@@ -5,14 +5,11 @@
27
28 import os
29
30-import pytz
31 from fixtures import TempDir
32
33 from lp.services.twistedsupport.loggingsupport import LaunchpadLogFile
34 from lp.testing import TestCase
35
36-UTC = pytz.utc
37-
38
39 class TestLaunchpadLogFile(TestCase):
40 def setUp(self):
41diff --git a/lib/lp/services/webapp/adapter.py b/lib/lp/services/webapp/adapter.py
42index b40eed7..a2585dd 100644
43--- a/lib/lp/services/webapp/adapter.py
44+++ b/lib/lp/services/webapp/adapter.py
45@@ -12,7 +12,6 @@ from functools import partial
46 from textwrap import dedent
47 from time import time
48
49-import pytz
50 import transaction
51 from lazr.restful.utils import get_current_browser_request
52 from psycopg2.extensions import (
53@@ -75,8 +74,6 @@ __all__ = [
54 ]
55
56
57-UTC = pytz.utc
58-
59 classImplements(TimeoutError, IRequestExpired)
60
61
62diff --git a/lib/lp/services/webapp/errorlog.py b/lib/lp/services/webapp/errorlog.py
63index 4da8578..9d98412 100644
64--- a/lib/lp/services/webapp/errorlog.py
65+++ b/lib/lp/services/webapp/errorlog.py
66@@ -12,7 +12,6 @@ from urllib.parse import urlparse
67 import oops.createhooks
68 import oops_amqp
69 import oops_timeline
70-import pytz
71 import six
72 from lazr.restful.utils import get_current_browser_request
73 from oops_datedir_repo import DateDirRepo
74@@ -45,8 +44,6 @@ from lp.services.webapp.opstats import OpStats
75 from lp.services.webapp.pgsession import PGSessionBase
76 from lp.services.webapp.vhosts import allvhosts
77
78-UTC = pytz.utc
79-
80 LAZR_OOPS_USER_REQUESTED_KEY = "lazr.oops.user_requested"
81
82
83diff --git a/lib/lp/services/webapp/tests/test_errorlog.py b/lib/lp/services/webapp/tests/test_errorlog.py
84index 9c1e2a9..6eb6caf 100644
85--- a/lib/lp/services/webapp/tests/test_errorlog.py
86+++ b/lib/lp/services/webapp/tests/test_errorlog.py
87@@ -9,7 +9,6 @@ import traceback
88 from textwrap import dedent
89
90 import oops_amqp
91-import pytz
92 import testtools
93 from fixtures import TempDir
94 from lazr.batchnavigator.interfaces import InvalidBatchSizeError
95@@ -40,8 +39,6 @@ from lp.services.webapp.interfaces import IUnloggedException, NoReferrerError
96 from lp.testing import TestCaseWithFactory
97 from lp.testing.layers import LaunchpadZopelessLayer
98
99-UTC = pytz.utc
100-
101
102 class ArbitraryException(Exception):
103 """Used to test handling of exceptions in OOPS reports."""
104diff --git a/lib/lp/translations/browser/tests/translationmessage-views.rst b/lib/lp/translations/browser/tests/translationmessage-views.rst
105index b9bb43a..b3f15c9 100644
106--- a/lib/lp/translations/browser/tests/translationmessage-views.rst
107+++ b/lib/lp/translations/browser/tests/translationmessage-views.rst
108@@ -370,7 +370,6 @@ TranslationMessageSuggestions
109 This class keeps all suggestions available for a concrete
110 ITranslationMessage.
111
112- >>> import pytz
113 >>> from zope.component import getUtility
114 >>> from lp.translations.browser.translationmessage import (
115 ... TranslationMessageSuggestions,
116@@ -414,7 +413,6 @@ We are going to work with a plural form message.
117 Also, we are going to create a new translation for the Japanese
118 language that will be used as the suggestion.
119
120- >>> UTC = pytz.timezone("UTC")
121 >>> carlos = getUtility(IPersonSet).getByName("carlos")
122 >>> login("carlos@canonical.com")
123 >>> translation_message_ja = factory.makeCurrentTranslationMessage(
124diff --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
125index 806b5e7..a683b72 100644
126--- a/lib/lp/translations/doc/poimport-pofile-not-exported-from-rosetta.rst
127+++ b/lib/lp/translations/doc/poimport-pofile-not-exported-from-rosetta.rst
128@@ -27,8 +27,6 @@ Here are some imports we need to get this test running.
129 ... ITranslationImportQueue,
130 ... )
131 >>> from lp.translations.model.potemplate import POTemplateSubset
132- >>> import pytz
133- >>> UTC = pytz.timezone("UTC")
134 >>> translation_import_queue = getUtility(ITranslationImportQueue)
135 >>> rosetta_experts = getUtility(ILaunchpadCelebrities).rosetta_experts
136
137diff --git a/lib/lp/translations/doc/poimport-potemplate-syntax-error.rst b/lib/lp/translations/doc/poimport-potemplate-syntax-error.rst
138index ac12003..c14673d 100644
139--- a/lib/lp/translations/doc/poimport-potemplate-syntax-error.rst
140+++ b/lib/lp/translations/doc/poimport-potemplate-syntax-error.rst
141@@ -14,8 +14,6 @@ Here are some imports we need to get this test running.
142 ... ITranslationImportQueue,
143 ... )
144 >>> from lp.translations.model.potemplate import POTemplateSubset
145- >>> import pytz
146- >>> UTC = pytz.timezone("UTC")
147 >>> translation_import_queue = getUtility(ITranslationImportQueue)
148 >>> rosetta_experts = getUtility(ILaunchpadCelebrities).rosetta_experts
149
150diff --git a/lib/lp/translations/doc/rosetta-translation.rst b/lib/lp/translations/doc/rosetta-translation.rst
151index 3e993b5..90968fc 100644
152--- a/lib/lp/translations/doc/rosetta-translation.rst
153+++ b/lib/lp/translations/doc/rosetta-translation.rst
154@@ -48,8 +48,6 @@ Get a person to create a translation with.
155
156 Add a translation.
157
158- >>> import pytz
159- >>> UTC = pytz.timezone("UTC")
160 >>> message = factory.makeCurrentTranslationMessage(
161 ... pofile, potmsgset, translations=translations, current_other=True
162 ... )

Subscribers

People subscribed via source and target branches

to status/vote changes: