launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #26609
[Merge] ~cjwatson/launchpad:unused-functions into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:unused-functions into launchpad:master.
Commit message:
Remove various unused top-level functions
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/399456
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:unused-functions into launchpad:master.
diff --git a/lib/lp/app/browser/tales.py b/lib/lp/app/browser/tales.py
index 115bc0f..3020b39 100644
--- a/lib/lp/app/browser/tales.py
+++ b/lib/lp/app/browser/tales.py
@@ -2580,15 +2580,6 @@ class RevisionAuthorFormatterAPI(ObjectFormatterAPI):
return ''
-def clean_path_segments(request):
- """Returns list of path segments, excluding system-related segments."""
- proto_host_port = request.getApplicationURL()
- clean_url = request.getURL()
- clean_path = clean_url[len(proto_host_port):]
- clean_path_split = clean_path.split('/')
- return clean_path_split
-
-
@implementer(ITraversable)
class PermissionRequiredQuery:
"""Check if the logged in user has a given permission on a given object.
diff --git a/lib/lp/buildmaster/manager.py b/lib/lp/buildmaster/manager.py
index 9e58a34..039d215 100644
--- a/lib/lp/buildmaster/manager.py
+++ b/lib/lp/buildmaster/manager.py
@@ -77,12 +77,6 @@ JOB_RESET_THRESHOLD = 3
BUILDER_FAILURE_THRESHOLD = 5
-def build_candidate_sort_key(candidate):
- # Sort key for build candidates. This must match the ordering used in
- # BuildQueueSet.findBuildCandidates.
- return -candidate.lastscore, candidate.id
-
-
class PrefetchedBuildCandidates:
"""A set of build candidates updated using efficient bulk queries.
diff --git a/lib/lp/buildmaster/tests/test_doc.py b/lib/lp/buildmaster/tests/test_doc.py
index 15cebaa..0630514 100644
--- a/lib/lp/buildmaster/tests/test_doc.py
+++ b/lib/lp/buildmaster/tests/test_doc.py
@@ -7,14 +7,7 @@ from __future__ import absolute_import, print_function, unicode_literals
import os
-from lp.services.config import config
from lp.services.testing import build_test_suite
-from lp.testing import (
- ANONYMOUS,
- login,
- logout,
- )
-from lp.testing.dbuser import switch_dbuser
from lp.testing.layers import (
LaunchpadFunctionalLayer,
LaunchpadZopelessLayer,
@@ -22,7 +15,6 @@ from lp.testing.layers import (
from lp.testing.pages import setUpGlobs
from lp.testing.systemdocs import (
LayeredDocFileSuite,
- setGlobs,
setUp,
tearDown,
)
@@ -31,23 +23,6 @@ from lp.testing.systemdocs import (
here = os.path.dirname(os.path.realpath(__file__))
-def buildmasterSetUp(test):
- """Setup a typical builddmaster test environment.
-
- Log in as ANONYMOUS and perform DB operations as the builddmaster
- dbuser.
- """
- test_dbuser = config.builddmaster.dbuser
- login(ANONYMOUS)
- setGlobs(test)
- test.globs['test_dbuser'] = test_dbuser
- switch_dbuser(test_dbuser)
-
-
-def buildmasterTearDown(test):
- logout()
-
-
special = {
'builder.txt': LayeredDocFileSuite(
'../doc/builder.txt',
diff --git a/lib/lp/scripts/utilities/importpedant.py b/lib/lp/scripts/utilities/importpedant.py
index b7014ba..e19b5f1 100644
--- a/lib/lp/scripts/utilities/importpedant.py
+++ b/lib/lp/scripts/utilities/importpedant.py
@@ -21,10 +21,6 @@ warnings.filterwarnings('ignore', category=UserWarning, append=True,
message=r'Module .*? is being added to sys.path')
-def text_lines_to_set(text):
- return set(line.strip() for line in text.splitlines() if line.strip())
-
-
# Sometimes, third-party modules don't export all of their public APIs through
# __all__. The following dict maps from such modules to a list of attributes
# that are allowed to be imported, whether or not they are in __all__.
diff --git a/lib/lp/services/webapp/adapter.py b/lib/lp/services/webapp/adapter.py
index cb5ac0a..37c819d 100644
--- a/lib/lp/services/webapp/adapter.py
+++ b/lib/lp/services/webapp/adapter.py
@@ -35,7 +35,6 @@ from storm.databases.postgres import (
from storm.exceptions import TimeoutError
from storm.store import Store
from storm.tracer import install_tracer
-from storm.zope.interfaces import IZStorm
from timeline.timeline import Timeline
import transaction
from zope.component import getUtility
@@ -88,7 +87,6 @@ __all__ = [
'get_request_statements',
'get_request_start_time',
'get_request_duration',
- 'get_store_name',
'print_queries',
'soft_timeout_expired',
'start_sql_logging',
@@ -852,11 +850,6 @@ def get_object_from_master_store(obj):
return obj
-def get_store_name(store):
- """Helper to retrieve the store name for a ZStorm Store."""
- return getUtility(IZStorm).get_name(store)
-
-
class WhichDbView(LaunchpadView):
"A page that reports which database is being used by default."
diff --git a/lib/lp/services/webapp/canonicalurl.py b/lib/lp/services/webapp/canonicalurl.py
index c427aad..bd2a205 100644
--- a/lib/lp/services/webapp/canonicalurl.py
+++ b/lib/lp/services/webapp/canonicalurl.py
@@ -9,12 +9,10 @@ __metaclass__ = type
__all__ = [
'nearest_adapter',
'nearest_context_with_adapter',
- 'nearest_provides_or_adapted',
]
from zope.component import queryAdapter
-from lp.services.webapp.interfaces import NoCanonicalUrl
# XXX mars 2008-07-17
# This function should be moved into lazr.canonicalurl.
# See bug #185958.
@@ -49,23 +47,3 @@ def nearest_adapter(obj, interface, name=u''):
context, adapter = nearest_context_with_adapter(obj, interface, name=name)
# Will be None, None if not found.
return adapter
-
-
-def nearest_provides_or_adapted(obj, interface):
- """Find the nearest object that provides or can be adapted to `interface`.
-
- The function looks upward through the canonical url chain.
-
- :return None: if there is no object that provides or can be adapted in
- the url chain.
- """
- try:
- for curr_obj in canonical_url_iterator(obj):
- # If the curr_obj implements the interface, it is returned.
- impl = interface(curr_obj, None)
- if impl is not None:
- return impl
- except NoCanonicalUrl:
- # Do not break when canonical URL is not defined for an object.
- pass
- return None
diff --git a/lib/lp/soyuz/model/packagecloner.py b/lib/lp/soyuz/model/packagecloner.py
index 7c55c51..bbf6e29 100644
--- a/lib/lp/soyuz/model/packagecloner.py
+++ b/lib/lp/soyuz/model/packagecloner.py
@@ -7,12 +7,10 @@ __metaclass__ = type
__all__ = [
'PackageCloner',
- 'clone_packages',
]
import transaction
-from zope.component import getUtility
from zope.interface import implementer
from lp.services.database.constants import UTC_NOW
@@ -26,28 +24,6 @@ from lp.soyuz.interfaces.packagecloner import IPackageCloner
from lp.soyuz.model.publishing import BinaryPackagePublishingHistory
-def clone_packages(origin, destination, distroarchseries_list=None):
- """Copies packages from origin to destination package location.
-
- Binary packages are only copied for the `DistroArchSeries` pairs
- specified.
-
- This function is meant to simplify the utilization of the package
- cloning functionality.
-
- @type origin: PackageLocation
- @param origin: the location from which packages are to be copied.
- @type destination: PackageLocation
- @param destination: the location to which the data is to be copied.
- @type distroarchseries_list: list of pairs of (origin, destination)
- distroarchseries instances.
- @param distroarchseries_list: the binary packages will be copied
- for the distroarchseries pairs specified (if any).
- """
- pkg_cloner = getUtility(IPackageCloner)
- pkg_cloner.clonePackages(origin, destination, distroarchseries_list)
-
-
@implementer(IPackageCloner)
class PackageCloner:
"""Used for copying of various publishing history data across archives.
diff --git a/lib/lp/testing/layers.py b/lib/lp/testing/layers.py
index 1447f3b..1060fa9 100644
--- a/lib/lp/testing/layers.py
+++ b/lib/lp/testing/layers.py
@@ -221,28 +221,6 @@ def reconnect_stores(reset=False):
assert session_store() is not None, 'Failed to reconnect'
-def wait_children(seconds=120):
- """Wait for all children to exit.
-
- :param seconds: Maximum number of seconds to wait. If None, wait
- forever.
- """
- now = datetime.datetime.now
- if seconds is None:
- until = None
- else:
- until = now() + datetime.timedelta(seconds=seconds)
- while True:
- try:
- os.waitpid(-1, os.WNOHANG)
- except OSError as error:
- if error.errno != errno.ECHILD:
- raise
- break
- if until is not None and now() > until:
- break
-
-
class BaseLayer:
"""Base layer.