← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:unused into launchpad:master

 

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

Commit message:
Remove various bits of unused code

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

Found by Vulture, and verified by running the full test suite.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:unused into launchpad:master.
diff --git a/database/schema/fti.py b/database/schema/fti.py
index 44c0d16..4c8711c 100755
--- a/database/schema/fti.py
+++ b/database/schema/fti.py
@@ -30,8 +30,6 @@ from lp.services.scripts import (
     )
 
 
-PGSQL_BASE = '/usr/share/postgresql'
-
 # tsearch2 ranking constants:
 A, B, C, D = 'ABCD'
 
diff --git a/lib/lp/archivepublisher/diskpool.py b/lib/lp/archivepublisher/diskpool.py
index 84b7874..7257d83 100644
--- a/lib/lp/archivepublisher/diskpool.py
+++ b/lib/lp/archivepublisher/diskpool.py
@@ -6,7 +6,6 @@ __all__ = [
     'DiskPoolEntry',
     'FileAddActionEnum',
     'poolify',
-    'unpoolify',
     ]
 
 import logging
@@ -15,7 +14,6 @@ from pathlib import Path
 import tempfile
 from typing import (
     Optional,
-    Tuple,
     Union,
     )
 
@@ -45,19 +43,6 @@ def poolify(source: str, component: Optional[str] = None) -> Path:
     return path
 
 
-def unpoolify(self, path: Path) -> Tuple[str, str, Optional[str]]:
-    """Take a path and unpoolify it.
-
-    Return a tuple of component, source, filename
-    """
-    p = path.parts
-    if len(p) < 3 or len(p) > 4:
-        raise ValueError("Path %s is not in a valid pool form" % path)
-    if len(p) == 4:
-        return p[0], p[2], p[3]
-    return p[0], p[2], None
-
-
 def relative_symlink(src_path: Path, dst_path: Path) -> None:
     """Path.symlink_to replacement that creates relative symbolic links."""
     src_path = Path(os.path.normpath(str(src_path)))
diff --git a/lib/lp/archivepublisher/tests/test_signing.py b/lib/lp/archivepublisher/tests/test_signing.py
index e330354..b9ed398 100644
--- a/lib/lp/archivepublisher/tests/test_signing.py
+++ b/lib/lp/archivepublisher/tests/test_signing.py
@@ -294,7 +294,6 @@ class TestLocalSigningUpload(RunPartsMixin, TestSigningHelpers):
         upload = SigningUpload()
         # Under no circumstances is it safe to execute actual commands.
         self.fake_call = FakeMethod(result=0)
-        self.fake_copyfile = FakeMethod(result=0)
         upload.callLog = FakeMethodCallLog(upload=upload)
         self.useFixture(MonkeyPatch("subprocess.call", self.fake_call))
         upload.process(self.archive, self.path, self.suite)
diff --git a/lib/lp/bugs/browser/bugnomination.py b/lib/lp/bugs/browser/bugnomination.py
index 40dddbd..6a61931 100644
--- a/lib/lp/bugs/browser/bugnomination.py
+++ b/lib/lp/bugs/browser/bugnomination.py
@@ -9,9 +9,6 @@ __all__ = [
     'BugNominationEditView',
     'BugNominationTableRowView']
 
-import datetime
-
-import pytz
 from zope.component import getUtility
 from zope.interface import Interface
 
@@ -142,9 +139,6 @@ class BugNominationView(LaunchpadFormView):
 class BugNominationTableRowView(LaunchpadView):
     """Browser view class for rendering a nomination table row."""
 
-    # This method will be called to render the bug nomination.
-    renderNonConjoinedReplica = LaunchpadView.__call__
-
     def getNominationPerson(self):
         """Return the IPerson associated with this nomination.
 
@@ -171,25 +165,6 @@ class BugNominationTableRowView(LaunchpadView):
                 "Expected nomination to be Proposed or Declined. "
                 "Got status: %s" % self.context.status.title)
 
-    def getNominationDurationSinceCreatedOrDecided(self):
-        """Return a duration since this nomination was created or decided.
-
-        So if the nomination is currently Proposed, the duration will be from
-        date_created to now, and if the nomination is Approved/Declined, the
-        duration will be from date_decided until now.
-
-        This allows us to present a human-readable version of how long ago
-        the nomination was created or approved/declined.
-        """
-        UTC = pytz.timezone('UTC')
-        now = datetime.datetime.now(UTC)
-        bugnomination = self.context
-
-        if bugnomination.date_decided:
-            return now - bugnomination.date_decided
-
-        return now - bugnomination.date_created
-
     def userCanMakeDecisionForNomination(self):
         """Can the user approve/decline this nomination?"""
         return check_permission("launchpad.Driver", self.context)
diff --git a/lib/lp/bugs/model/tests/test_bugtask.py b/lib/lp/bugs/model/tests/test_bugtask.py
index ce372d6..ef2ab2b 100644
--- a/lib/lp/bugs/model/tests/test_bugtask.py
+++ b/lib/lp/bugs/model/tests/test_bugtask.py
@@ -1416,16 +1416,6 @@ class BugTaskSearchBugsElsewhereTest(unittest.TestCase):
             self.firefox_upstream.target.bug_supervisor)
         flush_database_updates()
 
-    def _hasUpstreamTask(self, bug):
-        """Does this bug have an upstream task associated with it?
-
-        Returns True if yes, otherwise False.
-        """
-        for bugtask in bug.bugtasks:
-            if bugtask.product is not None:
-                return True
-        return False
-
 
 class BugTaskSetFindExpirableBugTasksTest(unittest.TestCase):
     """Test `BugTaskSet.findExpirableBugTasks()` behaviour."""
diff --git a/lib/lp/bugs/tests/externalbugtracker.py b/lib/lp/bugs/tests/externalbugtracker.py
index 11dcaab..bf2618c 100644
--- a/lib/lp/bugs/tests/externalbugtracker.py
+++ b/lib/lp/bugs/tests/externalbugtracker.py
@@ -1197,7 +1197,6 @@ class TestTrac(BugTrackerResponsesMixin, Trac):
     # that we can test batching and not batching correctly.
     batch_size = None
     batch_query_threshold = 10
-    csv_export_file = None
 
     def getExternalBugTrackerToUse(self):
         return self
diff --git a/lib/lp/code/browser/branch.py b/lib/lp/code/browser/branch.py
index 6f9dc1a..0bdeb46 100644
--- a/lib/lp/code/browser/branch.py
+++ b/lib/lp/code/browser/branch.py
@@ -582,11 +582,6 @@ class BranchView(InformationTypePortletMixin, FeedsMixin, BranchMirrorMixin,
                 len(self.dependent_branches) == 0)
 
     @property
-    def show_candidate_more_link(self):
-        """Only show the link if there are more than five."""
-        return len(self.landing_candidates) > 5
-
-    @property
     def show_rescan_link(self):
         """Only show the rescan button if the latest scan has failed"""
         scan_job = self.context.getLatestScanJob()
diff --git a/lib/lp/registry/browser/teammembership.py b/lib/lp/registry/browser/teammembership.py
index 3610e3e..3c1c700 100644
--- a/lib/lp/registry/browser/teammembership.py
+++ b/lib/lp/registry/browser/teammembership.py
@@ -41,7 +41,6 @@ class TeamMembershipEditView(LaunchpadView):
         super().__init__(context, request)
         self.errormessage = ""
         self.prefix = 'membership'
-        self.max_year = 2050
         fields = form.Fields(Date(
             __name__='expirationdate', title=_('Expiration date')))
         expiration_field = fields['expirationdate']
diff --git a/lib/lp/registry/interfaces/poll.py b/lib/lp/registry/interfaces/poll.py
index 699ed59..8f95894 100644
--- a/lib/lp/registry/interfaces/poll.py
+++ b/lib/lp/registry/interfaces/poll.py
@@ -531,9 +531,6 @@ class OptionIsNotFromSimplePoll(Exception):
 class IVoteSet(Interface):
     """The set of all Vote objects."""
 
-    def newToken():
-        """Return a token that was never used in the Vote table."""
-
     def new(poll, option, preference, token, person):
         """Create a new Vote."""
 
diff --git a/lib/lp/registry/interfaces/product.py b/lib/lp/registry/interfaces/product.py
index 2d0c179..13abfe0 100644
--- a/lib/lp/registry/interfaces/product.py
+++ b/lib/lp/registry/interfaces/product.py
@@ -67,7 +67,6 @@ from zope.schema import (
     Text,
     TextLine,
     )
-from zope.schema.vocabulary import SimpleVocabulary
 
 from lp import _
 from lp.answers.interfaces.faqtarget import IFAQTarget
@@ -1116,10 +1115,6 @@ class IProductSet(Interface):
         """Get IProducts with a sourceforge project and no remote_product."""
 
 
-emptiness_vocabulary = SimpleVocabulary.fromItems(
-        [('Empty', True), ('Not Empty', False)])
-
-
 class IProductReviewSearch(Interface):
     """A search form for products being reviewed."""
 
diff --git a/lib/lp/registry/mail/teammembership.py b/lib/lp/registry/mail/teammembership.py
index 926d88d..b982156 100644
--- a/lib/lp/registry/mail/teammembership.py
+++ b/lib/lp/registry/mail/teammembership.py
@@ -36,15 +36,6 @@ from lp.services.webapp.url import urlappend
 class TeamMembershipRecipientReason(RecipientReason):
 
     @classmethod
-    def forInvitation(cls, admin, team, recipient, proposed_member, **kwargs):
-        header = cls.makeRationale(
-            "Invitation (%s)" % team.name, proposed_member)
-        reason = (
-            "You received this email because %%(lc_entity_is)s an admin of "
-            "the %s team." % proposed_member.displayname)
-        return cls(admin, recipient, header, reason, **kwargs)
-
-    @classmethod
     def forMember(cls, member, team, recipient, **kwargs):
         header = cls.makeRationale("Member (%s)" % team.name, member)
         reason = (
diff --git a/lib/lp/registry/tests/test_gpgkey.py b/lib/lp/registry/tests/test_gpgkey.py
index 878fcca..2d740c4 100644
--- a/lib/lp/registry/tests/test_gpgkey.py
+++ b/lib/lp/registry/tests/test_gpgkey.py
@@ -12,10 +12,6 @@ from zope.component import getUtility
 
 from lp.registry.interfaces.gpg import IGPGKeySet
 from lp.registry.interfaces.person import IPersonSet
-from lp.services.config.fixture import (
-    ConfigFixture,
-    ConfigUseFixture,
-    )
 from lp.services.gpg.interfaces import GPGKeyAlgorithm
 from lp.services.verification.interfaces.authtoken import LoginTokenType
 from lp.services.verification.interfaces.logintoken import ILoginTokenSet
@@ -94,14 +90,3 @@ class GPGKeySetTests(TestCaseWithFactory):
 
         inactive_keys = keyset.getGPGKeysForPerson(person, active=False)
         self.assertThat(inactive_keys, HasLength(0))
-
-    def set_config_parameters(self, **kwargs):
-        config_name = self.getUniqueString()
-        config_fixture = self.useFixture(
-            ConfigFixture(
-                config_name,
-                LaunchpadFunctionalLayer.config_fixture.instance_name))
-        setting_lines = ['[launchpad]'] + \
-            ['%s: %s' % (k, v) for k, v in kwargs.items()]
-        config_fixture.add_section('\n'.join(setting_lines))
-        self.useFixture(ConfigUseFixture(config_name))
diff --git a/lib/lp/registry/tests/test_productseries.py b/lib/lp/registry/tests/test_productseries.py
index e80452e..2967e90 100644
--- a/lib/lp/registry/tests/test_productseries.py
+++ b/lib/lp/registry/tests/test_productseries.py
@@ -23,7 +23,6 @@ from lp.registry.errors import (
     ProprietaryPillar,
     )
 from lp.registry.interfaces.distribution import IDistributionSet
-from lp.registry.interfaces.distroseries import IDistroSeriesSet
 from lp.registry.interfaces.productseries import (
     IProductSeries,
     IProductSeriesSet,
@@ -140,11 +139,9 @@ class TestProductSeriesSetPackaging(TestCaseWithFactory):
         # Set up productseries.
         self.person = self.factory.makePerson()
         self.product = self.factory.makeProduct(owner=self.person)
-        self.dev_focus = self.product.development_focus
         self.product_series = self.factory.makeProductSeries(self.product)
 
         # Set up distroseries.
-        self.distroseries_set = getUtility(IDistroSeriesSet)
         self.distribution_set = getUtility(IDistributionSet)
         self.ubuntu = self.distribution_set.getByName("ubuntu")
         self.debian = self.distribution_set.getByName("debian")
diff --git a/lib/lp/scripts/utilities/settingsauditor.py b/lib/lp/scripts/utilities/settingsauditor.py
index 74598f7..fbd5c6f 100644
--- a/lib/lp/scripts/utilities/settingsauditor.py
+++ b/lib/lp/scripts/utilities/settingsauditor.py
@@ -25,8 +25,6 @@ class SettingsAuditor:
     def __init__(self, data):
         self.data = data
         self.errors = {}
-        self.current_section = ''
-        self.observed_settings = defaultdict(lambda: 0)
 
     def _getHeader(self):
         """Removes the header comments from the security file.
@@ -45,12 +43,6 @@ class SettingsAuditor:
         data = [d.strip() for d in data]
         return '\n'.join(d for d in data if not (d.startswith('#') or d == ''))
 
-    def _getSectionName(self, line):
-        if line.strip().startswith('['):
-            return self.section_regex.match(line).group()
-        else:
-            return None
-
     def _separateConfigBlocks(self):
         # We keep the copy of config_labels so we can keep them in order.
         self.config_blocks = {}
diff --git a/lib/lp/services/helpers.py b/lib/lp/services/helpers.py
index ef5fc41..d279ce3 100644
--- a/lib/lp/services/helpers.py
+++ b/lib/lp/services/helpers.py
@@ -90,7 +90,7 @@ def bytes_to_tarfile(s):
     return tarfile.open('', 'r', BytesIO(s))
 
 
-def simple_popen2(command, input, env=None, in_bufsize=1024, out_bufsize=128):
+def simple_popen2(command, input, env=None):
     """Run a command, give it input on its standard input, and capture its
     standard output.
 
diff --git a/lib/lp/services/mail/notification.py b/lib/lp/services/mail/notification.py
index 8475c4e..9ff90c3 100644
--- a/lib/lp/services/mail/notification.py
+++ b/lib/lp/services/mail/notification.py
@@ -22,7 +22,6 @@ from lp.services.mail.mailwrapper import MailWrapper
 from lp.services.mail.sendmail import sendmail
 
 
-CC = "CC"
 MAX_RETURN_MESSAGE_SIZE = config.processmail.max_error_message_return_size
 
 
diff --git a/lib/lp/soyuz/mail/notifications.py b/lib/lp/soyuz/mail/notifications.py
index 446bcfe..9aaca22 100644
--- a/lib/lp/soyuz/mail/notifications.py
+++ b/lib/lp/soyuz/mail/notifications.py
@@ -17,9 +17,6 @@ from lp.services.webapp.interfaces import ILaunchpadRoot
 from lp.services.webapp.publisher import canonical_url
 
 
-CC = "CC"
-
-
 @block_implicit_flushes
 def notify_new_ppa_subscription(subscription, event):
     """Notification that a new PPA subscription can be activated."""
diff --git a/lib/lp/soyuz/model/archive.py b/lib/lp/soyuz/model/archive.py
index 6e748a3..3515b5c 100644
--- a/lib/lp/soyuz/model/archive.py
+++ b/lib/lp/soyuz/model/archive.py
@@ -1154,7 +1154,6 @@ class Archive(SQLBase):
         if not check_permission('launchpad.View', dependency):
             raise ArchiveDependencyError(
                 "You don't have permission to use this dependency.")
-            return
         if not dependency.enabled:
             raise ArchiveDependencyError("Dependencies must not be disabled.")
         if dependency.distribution != self.distribution:
diff --git a/lib/lp/testing/layers.py b/lib/lp/testing/layers.py
index 6af3146..abdc224 100644
--- a/lib/lp/testing/layers.py
+++ b/lib/lp/testing/layers.py
@@ -156,7 +156,6 @@ from lp.testing.pgsql import PgTestSetup
 import zcml
 
 
-COMMA = ','
 WAIT_INTERVAL = datetime.timedelta(seconds=180)
 
 
@@ -775,11 +774,6 @@ class DatabaseLayer(BaseLayer):
     def connect(cls):
         return cls._db_fixture.connect()
 
-    @classmethod
-    @profiled
-    def _dropDb(cls):
-        return cls._db_fixture.dropDb()
-
 
 class LibrarianLayer(DatabaseLayer):
     """Provides tests access to a Librarian instance.
diff --git a/lib/lp/translations/model/pofile.py b/lib/lp/translations/model/pofile.py
index a5e8162..d3a883a 100644
--- a/lib/lp/translations/model/pofile.py
+++ b/lib/lp/translations/model/pofile.py
@@ -1253,7 +1253,6 @@ class DummyPOFile(POFileMixIn):
 
         self.path = 'unknown'
         self.datecreated = datetime.datetime.now(UTC)
-        self.last_touched_pomsgset = None
         self.contributors = []
         self.from_sourcepackagename = None
         self.translation_messages = None
diff --git a/lib/lp/translations/model/potmsgset.py b/lib/lp/translations/model/potmsgset.py
index 49c4051..9cb6702 100644
--- a/lib/lp/translations/model/potmsgset.py
+++ b/lib/lp/translations/model/potmsgset.py
@@ -112,10 +112,6 @@ credits_message_str = ('This is a dummy translation so that the '
                        'credits are counted as translated.')
 
 
-# Marker for "no incumbent message found yet."
-incumbent_unknown = object()
-
-
 def dictify_translations(translations):
     """Represent `translations` as a normalized dict.
 
diff --git a/lib/lp/translations/model/translationmessage.py b/lib/lp/translations/model/translationmessage.py
index 796ce8b..41332cd 100644
--- a/lib/lp/translations/model/translationmessage.py
+++ b/lib/lp/translations/model/translationmessage.py
@@ -183,7 +183,6 @@ class DummyTranslationMessage(TranslationMessageMixIn):
         self.is_current_upstream = False
         self.is_empty = True
         self.was_obsolete_in_last_import = False
-        self.was_complete_in_last_import = False
         if self.potmsgset.msgid_plural is None:
             self.translations = [None]
         else:
diff --git a/lib/lp/translations/tests/test_pofile.py b/lib/lp/translations/tests/test_pofile.py
index 1c7ce5c..9eed166 100644
--- a/lib/lp/translations/tests/test_pofile.py
+++ b/lib/lp/translations/tests/test_pofile.py
@@ -2499,7 +2499,6 @@ class TestPOFileToTranslationFileDataAdapter(TestCaseWithFactory):
         Content-Transfer-Encoding: 8bit
         Plural-Forms: %s""")
 
-    western_plural = "nplurals=2; plural=(n != 1)"
     other_2_plural = "nplurals=2; plural=(n > 0)"
     generic_plural = "nplurals=INTEGER; plural=EXPRESSION"
     serbian3_plural = ("nplurals=3; plural=(n%10==1 && n%100!=11 "
diff --git a/lib/lp/translations/tests/test_translatedlanguage.py b/lib/lp/translations/tests/test_translatedlanguage.py
index 04e8369..d95f185 100644
--- a/lib/lp/translations/tests/test_translatedlanguage.py
+++ b/lib/lp/translations/tests/test_translatedlanguage.py
@@ -391,8 +391,6 @@ class TestTranslatedLanguageMixin(TestCaseWithFactory):
         # Changed count is 'updatescount' on POFile.
         # It has to be lower or equal to currentcount.
         naked_pofile.updatescount = 1
-        # new is rosettacount-updatescount.
-        naked_pofile.newcount = 0
         naked_pofile.unreviewed_count = 3
 
         translated_language.recalculateCounts()
diff --git a/lib/lp/translations/utilities/gettext_po_importer.py b/lib/lp/translations/utilities/gettext_po_importer.py
index 1175e56..0b70396 100644
--- a/lib/lp/translations/utilities/gettext_po_importer.py
+++ b/lib/lp/translations/utilities/gettext_po_importer.py
@@ -26,7 +26,6 @@ class GettextPOImporter:
     """Support class to import gettext .po files."""
 
     def __init__(self, context=None):
-        self.basepath = None
         self.productseries = None
         self.distroseries = None
         self.sourcepackagename = None
@@ -48,7 +47,6 @@ class GettextPOImporter:
 
     def parse(self, translation_import_queue_entry):
         """See `ITranslationFormatImporter`."""
-        self.basepath = translation_import_queue_entry.path
         self.productseries = translation_import_queue_entry.productseries
         self.distroseries = translation_import_queue_entry.distroseries
         self.sourcepackagename = (