Merge ~cjwatson/launchpad:unused-functions into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: b660f23289d7d738ee4dfa5c98f3e47dbac9c46b
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:unused-functions
Merge into: launchpad:master
Diff against target: 254 lines (+0/-119)
8 files modified
lib/lp/app/browser/tales.py (+0/-9)
lib/lp/buildmaster/manager.py (+0/-6)
lib/lp/buildmaster/tests/test_doc.py (+0/-25)
lib/lp/scripts/utilities/importpedant.py (+0/-4)
lib/lp/services/webapp/adapter.py (+0/-7)
lib/lp/services/webapp/canonicalurl.py (+0/-22)
lib/lp/soyuz/model/packagecloner.py (+0/-24)
lib/lp/testing/layers.py (+0/-22)
Reviewer Review Type Date Requested Status
Ioana Lasc (community) Approve
Review via email: mp+399456@code.launchpad.net

Commit message

Remove various unused top-level functions

To post a comment you must log in.
Revision history for this message
Ioana Lasc (ilasc) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/app/browser/tales.py b/lib/lp/app/browser/tales.py
2index 115bc0f..3020b39 100644
3--- a/lib/lp/app/browser/tales.py
4+++ b/lib/lp/app/browser/tales.py
5@@ -2580,15 +2580,6 @@ class RevisionAuthorFormatterAPI(ObjectFormatterAPI):
6 return ''
7
8
9-def clean_path_segments(request):
10- """Returns list of path segments, excluding system-related segments."""
11- proto_host_port = request.getApplicationURL()
12- clean_url = request.getURL()
13- clean_path = clean_url[len(proto_host_port):]
14- clean_path_split = clean_path.split('/')
15- return clean_path_split
16-
17-
18 @implementer(ITraversable)
19 class PermissionRequiredQuery:
20 """Check if the logged in user has a given permission on a given object.
21diff --git a/lib/lp/buildmaster/manager.py b/lib/lp/buildmaster/manager.py
22index 9e58a34..039d215 100644
23--- a/lib/lp/buildmaster/manager.py
24+++ b/lib/lp/buildmaster/manager.py
25@@ -77,12 +77,6 @@ JOB_RESET_THRESHOLD = 3
26 BUILDER_FAILURE_THRESHOLD = 5
27
28
29-def build_candidate_sort_key(candidate):
30- # Sort key for build candidates. This must match the ordering used in
31- # BuildQueueSet.findBuildCandidates.
32- return -candidate.lastscore, candidate.id
33-
34-
35 class PrefetchedBuildCandidates:
36 """A set of build candidates updated using efficient bulk queries.
37
38diff --git a/lib/lp/buildmaster/tests/test_doc.py b/lib/lp/buildmaster/tests/test_doc.py
39index 15cebaa..0630514 100644
40--- a/lib/lp/buildmaster/tests/test_doc.py
41+++ b/lib/lp/buildmaster/tests/test_doc.py
42@@ -7,14 +7,7 @@ from __future__ import absolute_import, print_function, unicode_literals
43
44 import os
45
46-from lp.services.config import config
47 from lp.services.testing import build_test_suite
48-from lp.testing import (
49- ANONYMOUS,
50- login,
51- logout,
52- )
53-from lp.testing.dbuser import switch_dbuser
54 from lp.testing.layers import (
55 LaunchpadFunctionalLayer,
56 LaunchpadZopelessLayer,
57@@ -22,7 +15,6 @@ from lp.testing.layers import (
58 from lp.testing.pages import setUpGlobs
59 from lp.testing.systemdocs import (
60 LayeredDocFileSuite,
61- setGlobs,
62 setUp,
63 tearDown,
64 )
65@@ -31,23 +23,6 @@ from lp.testing.systemdocs import (
66 here = os.path.dirname(os.path.realpath(__file__))
67
68
69-def buildmasterSetUp(test):
70- """Setup a typical builddmaster test environment.
71-
72- Log in as ANONYMOUS and perform DB operations as the builddmaster
73- dbuser.
74- """
75- test_dbuser = config.builddmaster.dbuser
76- login(ANONYMOUS)
77- setGlobs(test)
78- test.globs['test_dbuser'] = test_dbuser
79- switch_dbuser(test_dbuser)
80-
81-
82-def buildmasterTearDown(test):
83- logout()
84-
85-
86 special = {
87 'builder.txt': LayeredDocFileSuite(
88 '../doc/builder.txt',
89diff --git a/lib/lp/scripts/utilities/importpedant.py b/lib/lp/scripts/utilities/importpedant.py
90index b7014ba..e19b5f1 100644
91--- a/lib/lp/scripts/utilities/importpedant.py
92+++ b/lib/lp/scripts/utilities/importpedant.py
93@@ -21,10 +21,6 @@ warnings.filterwarnings('ignore', category=UserWarning, append=True,
94 message=r'Module .*? is being added to sys.path')
95
96
97-def text_lines_to_set(text):
98- return set(line.strip() for line in text.splitlines() if line.strip())
99-
100-
101 # Sometimes, third-party modules don't export all of their public APIs through
102 # __all__. The following dict maps from such modules to a list of attributes
103 # that are allowed to be imported, whether or not they are in __all__.
104diff --git a/lib/lp/services/webapp/adapter.py b/lib/lp/services/webapp/adapter.py
105index cb5ac0a..37c819d 100644
106--- a/lib/lp/services/webapp/adapter.py
107+++ b/lib/lp/services/webapp/adapter.py
108@@ -35,7 +35,6 @@ from storm.databases.postgres import (
109 from storm.exceptions import TimeoutError
110 from storm.store import Store
111 from storm.tracer import install_tracer
112-from storm.zope.interfaces import IZStorm
113 from timeline.timeline import Timeline
114 import transaction
115 from zope.component import getUtility
116@@ -88,7 +87,6 @@ __all__ = [
117 'get_request_statements',
118 'get_request_start_time',
119 'get_request_duration',
120- 'get_store_name',
121 'print_queries',
122 'soft_timeout_expired',
123 'start_sql_logging',
124@@ -852,11 +850,6 @@ def get_object_from_master_store(obj):
125 return obj
126
127
128-def get_store_name(store):
129- """Helper to retrieve the store name for a ZStorm Store."""
130- return getUtility(IZStorm).get_name(store)
131-
132-
133 class WhichDbView(LaunchpadView):
134 "A page that reports which database is being used by default."
135
136diff --git a/lib/lp/services/webapp/canonicalurl.py b/lib/lp/services/webapp/canonicalurl.py
137index c427aad..bd2a205 100644
138--- a/lib/lp/services/webapp/canonicalurl.py
139+++ b/lib/lp/services/webapp/canonicalurl.py
140@@ -9,12 +9,10 @@ __metaclass__ = type
141 __all__ = [
142 'nearest_adapter',
143 'nearest_context_with_adapter',
144- 'nearest_provides_or_adapted',
145 ]
146
147 from zope.component import queryAdapter
148
149-from lp.services.webapp.interfaces import NoCanonicalUrl
150 # XXX mars 2008-07-17
151 # This function should be moved into lazr.canonicalurl.
152 # See bug #185958.
153@@ -49,23 +47,3 @@ def nearest_adapter(obj, interface, name=u''):
154 context, adapter = nearest_context_with_adapter(obj, interface, name=name)
155 # Will be None, None if not found.
156 return adapter
157-
158-
159-def nearest_provides_or_adapted(obj, interface):
160- """Find the nearest object that provides or can be adapted to `interface`.
161-
162- The function looks upward through the canonical url chain.
163-
164- :return None: if there is no object that provides or can be adapted in
165- the url chain.
166- """
167- try:
168- for curr_obj in canonical_url_iterator(obj):
169- # If the curr_obj implements the interface, it is returned.
170- impl = interface(curr_obj, None)
171- if impl is not None:
172- return impl
173- except NoCanonicalUrl:
174- # Do not break when canonical URL is not defined for an object.
175- pass
176- return None
177diff --git a/lib/lp/soyuz/model/packagecloner.py b/lib/lp/soyuz/model/packagecloner.py
178index 7c55c51..bbf6e29 100644
179--- a/lib/lp/soyuz/model/packagecloner.py
180+++ b/lib/lp/soyuz/model/packagecloner.py
181@@ -7,12 +7,10 @@ __metaclass__ = type
182
183 __all__ = [
184 'PackageCloner',
185- 'clone_packages',
186 ]
187
188
189 import transaction
190-from zope.component import getUtility
191 from zope.interface import implementer
192
193 from lp.services.database.constants import UTC_NOW
194@@ -26,28 +24,6 @@ from lp.soyuz.interfaces.packagecloner import IPackageCloner
195 from lp.soyuz.model.publishing import BinaryPackagePublishingHistory
196
197
198-def clone_packages(origin, destination, distroarchseries_list=None):
199- """Copies packages from origin to destination package location.
200-
201- Binary packages are only copied for the `DistroArchSeries` pairs
202- specified.
203-
204- This function is meant to simplify the utilization of the package
205- cloning functionality.
206-
207- @type origin: PackageLocation
208- @param origin: the location from which packages are to be copied.
209- @type destination: PackageLocation
210- @param destination: the location to which the data is to be copied.
211- @type distroarchseries_list: list of pairs of (origin, destination)
212- distroarchseries instances.
213- @param distroarchseries_list: the binary packages will be copied
214- for the distroarchseries pairs specified (if any).
215- """
216- pkg_cloner = getUtility(IPackageCloner)
217- pkg_cloner.clonePackages(origin, destination, distroarchseries_list)
218-
219-
220 @implementer(IPackageCloner)
221 class PackageCloner:
222 """Used for copying of various publishing history data across archives.
223diff --git a/lib/lp/testing/layers.py b/lib/lp/testing/layers.py
224index 1447f3b..1060fa9 100644
225--- a/lib/lp/testing/layers.py
226+++ b/lib/lp/testing/layers.py
227@@ -221,28 +221,6 @@ def reconnect_stores(reset=False):
228 assert session_store() is not None, 'Failed to reconnect'
229
230
231-def wait_children(seconds=120):
232- """Wait for all children to exit.
233-
234- :param seconds: Maximum number of seconds to wait. If None, wait
235- forever.
236- """
237- now = datetime.datetime.now
238- if seconds is None:
239- until = None
240- else:
241- until = now() + datetime.timedelta(seconds=seconds)
242- while True:
243- try:
244- os.waitpid(-1, os.WNOHANG)
245- except OSError as error:
246- if error.errno != errno.ECHILD:
247- raise
248- break
249- if until is not None and now() > until:
250- break
251-
252-
253 class BaseLayer:
254 """Base layer.
255

Subscribers

People subscribed via source and target branches

to status/vote changes: