← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/octal-constants into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/octal-constants into lp:launchpad.

Commit message:
Use Python 3-style octal constants.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/octal-constants/+merge/285211

Use Python 3-style octal constants.

Now that vim in xenial is built with Python 3 and I upgraded my pyflakes.vim to match, my editor is complaining at me about the Python 2-style octal constants in various places.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/octal-constants into lp:launchpad.
=== modified file 'lib/lp/answers/tests/test_question_webservice.py'
--- lib/lp/answers/tests/test_question_webservice.py	2015-10-26 14:54:43 +0000
+++ lib/lp/answers/tests/test_question_webservice.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2011-2015 Canonical Ltd.  This software is licensed under the
+# Copyright 2011-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Webservice unit tests related to Launchpad Questions."""
@@ -264,7 +264,7 @@
 
     def test_searchQuestions(self):
         date_gen = time_counter(
-            datetime(2015, 01, 01, tzinfo=pytz.UTC), timedelta(days=1))
+            datetime(2015, 1, 1, tzinfo=pytz.UTC), timedelta(days=1))
         created = [
             self.factory.makeQuestion(title="foo", datecreated=next(date_gen))
             for i in range(10)]

=== modified file 'lib/lp/app/browser/tests/test_vocabulary.py'
--- lib/lp/app/browser/tests/test_vocabulary.py	2015-07-08 16:05:11 +0000
+++ lib/lp/app/browser/tests/test_vocabulary.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2011-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test vocabulary adapters."""
@@ -138,8 +138,7 @@
     def test_PersonPickerEntrySourceAdapter_user(self):
         # The person picker provides more information for users.
         person = self.factory.makePerson(email='snarf@xxxxxx', name='snarf')
-        creation_date = datetime(
-            2005, 01, 30, 0, 0, 0, 0, pytz.timezone('UTC'))
+        creation_date = datetime(2005, 1, 30, 0, 0, 0, 0, pytz.timezone('UTC'))
         removeSecurityProxy(person).datecreated = creation_date
         getUtility(IIrcIDSet).new(person, 'eg.dom', 'snarf')
         getUtility(IIrcIDSet).new(person, 'ex.dom', 'pting')
@@ -535,8 +534,7 @@
             name='xpting-team',
             membership_policy=TeamMembershipPolicy.RESTRICTED)
         person = self.factory.makePerson(name='xpting-person')
-        creation_date = datetime(
-            2005, 01, 30, 0, 0, 0, 0, pytz.timezone('UTC'))
+        creation_date = datetime(2005, 1, 30, 0, 0, 0, 0, pytz.timezone('UTC'))
         removeSecurityProxy(person).datecreated = creation_date
         TestPersonVocabulary.test_persons.extend([team, person])
         product = self.factory.makeProduct(owner=team)

=== modified file 'lib/lp/archivepublisher/config.py'
--- lib/lp/archivepublisher/config.py	2016-01-13 17:09:34 +0000
+++ lib/lp/archivepublisher/config.py	2016-02-05 16:55:09 +0000
@@ -141,4 +141,4 @@
             if directory is None:
                 continue
             if not os.path.exists(directory):
-                os.makedirs(directory, 0755)
+                os.makedirs(directory, 0o755)

=== modified file 'lib/lp/archivepublisher/customupload.py'
--- lib/lp/archivepublisher/customupload.py	2013-07-25 17:05:20 +0000
+++ lib/lp/archivepublisher/customupload.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2013 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Infrastructure for handling custom uploads.
@@ -247,7 +247,7 @@
         """Ensure the parent directory exists."""
         parentdir = os.path.dirname(path)
         if not os.path.isdir(parentdir):
-            os.makedirs(parentdir, 0755)
+            os.makedirs(parentdir, 0o755)
 
     def installFiles(self):
         """Install the files from the custom upload to the archive."""
@@ -267,8 +267,8 @@
                 # Also, ensure that the process has the expected umask.
                 old_mask = os.umask(0)
                 try:
-                    if old_mask != 022:
-                        raise CustomUploadBadUmask(022, old_mask)
+                    if old_mask != 0o022:
+                        raise CustomUploadBadUmask(0o022, old_mask)
                 finally:
                     os.umask(old_mask)
                 if os.path.islink(sourcepath):
@@ -296,7 +296,7 @@
                     os.symlink(os.readlink(sourcepath), destpath)
                 else:
                     shutil.copy(sourcepath, destpath)
-                    os.chmod(destpath, 0644)
+                    os.chmod(destpath, 0o644)
 
                 extracted = True
 

=== modified file 'lib/lp/archivepublisher/diskpool.py'
--- lib/lp/archivepublisher/diskpool.py	2015-10-21 09:37:08 +0000
+++ lib/lp/archivepublisher/diskpool.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __all__ = ['DiskPoolEntry', 'DiskPool', 'poolify', 'unpoolify']
@@ -105,7 +105,7 @@
     def close(self):
         """Make the atomic move into place having closed the temp file."""
         self.fd.close()
-        os.chmod(self.tempname, 0644)
+        os.chmod(self.tempname, 0o644)
         # Note that this will fail if the target and the temp dirs are on
         # different filesystems.
         os.rename(self.tempname, self.targetfilename)

=== modified file 'lib/lp/archivepublisher/model/ftparchive.py'
--- lib/lp/archivepublisher/model/ftparchive.py	2016-02-04 19:46:52 +0000
+++ lib/lp/archivepublisher/model/ftparchive.py	2016-02-05 16:55:09 +0000
@@ -52,7 +52,7 @@
 def safe_mkdir(path):
     """Ensures the path exists, creating it if it doesn't."""
     if not os.path.exists(path):
-        os.makedirs(path, 0755)
+        os.makedirs(path, 0o755)
 
 
 DEFAULT_COMPONENT = "main"

=== modified file 'lib/lp/archivepublisher/scripts/generate_contents_files.py'
--- lib/lp/archivepublisher/scripts/generate_contents_files.py	2016-01-13 17:09:34 +0000
+++ lib/lp/archivepublisher/scripts/generate_contents_files.py	2016-02-05 16:55:09 +0000
@@ -275,7 +275,7 @@
             ensure_directory_exists(os.path.dirname(contents_dest))
             os.rename(current_contents, last_contents)
             os.rename(new_contents, contents_dest)
-            os.chmod(contents_dest, 0664)
+            os.chmod(contents_dest, 0o664)
         else:
             self.logger.debug(
                 "Skipping unmodified Contents file for %s/%s.", suite, arch)

=== modified file 'lib/lp/archivepublisher/tests/test_ddtp_tarball.py'
--- lib/lp/archivepublisher/tests/test_ddtp_tarball.py	2012-07-03 17:32:59 +0000
+++ lib/lp/archivepublisher/tests/test_ddtp_tarball.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2012-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test ddtp-tarball custom uploads.
@@ -30,8 +30,8 @@
         self.temp_dir = self.makeTemporaryDirectory()
         self.pubconf = FakeConfig(self.temp_dir)
         self.suite = "distroseries"
-        # CustomUpload.installFiles requires a umask of 022.
-        old_umask = os.umask(022)
+        # CustomUpload.installFiles requires a umask of 0o022.
+        old_umask = os.umask(0o022)
         self.addCleanup(os.umask, old_umask)
 
     def openArchive(self, version):

=== modified file 'lib/lp/archivepublisher/tests/test_debian_installer.py'
--- lib/lp/archivepublisher/tests/test_debian_installer.py	2012-06-28 16:32:27 +0000
+++ lib/lp/archivepublisher/tests/test_debian_installer.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2012-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test debian-installer custom uploads.
@@ -34,8 +34,8 @@
         self.temp_dir = self.makeTemporaryDirectory()
         self.pubconf = FakeConfig(self.temp_dir)
         self.suite = "distroseries"
-        # CustomUpload.installFiles requires a umask of 022.
-        old_umask = os.umask(022)
+        # CustomUpload.installFiles requires a umask of 0o022.
+        old_umask = os.umask(0o022)
         self.addCleanup(os.umask, old_umask)
 
     def openArchive(self):
@@ -82,10 +82,10 @@
         self.assertRaises(CustomUploadAlreadyExists, self.process)
 
     def test_bad_umask(self):
-        # The umask must be 022 to avoid incorrect permissions.
+        # The umask must be 0o022 to avoid incorrect permissions.
         self.openArchive()
         self.addFile("dir/file", "foo")
-        os.umask(002)  # cleanup already handled by setUp
+        os.umask(0o002)  # cleanup already handled by setUp
         self.assertRaises(CustomUploadBadUmask, self.process)
 
     def test_current_symlink(self):
@@ -133,18 +133,18 @@
                 self.getInstallerPath(link_to_dir_path))))
 
     def test_top_level_permissions(self):
-        # Top-level directories are set to mode 0755 (see bug 107068).
+        # Top-level directories are set to mode 0o755 (see bug 107068).
         self.openArchive()
         self.addFile("hello", "world")
         self.process()
         installer_path = self.getInstallerPath()
-        self.assertEqual(0755, os.stat(installer_path).st_mode & 0777)
+        self.assertEqual(0o755, os.stat(installer_path).st_mode & 0o777)
         self.assertEqual(
-            0755,
-            os.stat(os.path.join(installer_path, os.pardir)).st_mode & 0777)
+            0o755,
+            os.stat(os.path.join(installer_path, os.pardir)).st_mode & 0o777)
 
     def test_extracted_permissions(self):
-        # Extracted files and directories are set to 0644/0755.
+        # Extracted files and directories are set to 0o644/0o755.
         self.openArchive()
         directory = ("images/netboot/ubuntu-installer/i386/"
                      "pxelinux.cfg.serial-9600")
@@ -152,9 +152,9 @@
         self.addFile(filename, "hey")
         self.process()
         self.assertEqual(
-            0644, os.stat(self.getInstallerPath(filename)).st_mode & 0777)
+            0o644, os.stat(self.getInstallerPath(filename)).st_mode & 0o777)
         self.assertEqual(
-            0755, os.stat(self.getInstallerPath(directory)).st_mode & 0777)
+            0o755, os.stat(self.getInstallerPath(directory)).st_mode & 0o777)
 
     def test_getSeriesKey_extracts_architecture(self):
         # getSeriesKey extracts the architecture from an upload's filename.

=== modified file 'lib/lp/archivepublisher/tests/test_dist_upgrader.py'
--- lib/lp/archivepublisher/tests/test_dist_upgrader.py	2012-06-28 16:32:27 +0000
+++ lib/lp/archivepublisher/tests/test_dist_upgrader.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2012-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test dist-upgrader custom uploads.
@@ -35,8 +35,8 @@
         self.temp_dir = self.makeTemporaryDirectory()
         self.pubconf = FakeConfig(self.temp_dir)
         self.suite = "distroseries"
-        # CustomUpload.installFiles requires a umask of 022.
-        old_umask = os.umask(022)
+        # CustomUpload.installFiles requires a umask of 0o022.
+        old_umask = os.umask(0o022)
         self.addCleanup(os.umask, old_umask)
 
     def openArchive(self, version):
@@ -68,10 +68,10 @@
         self.assertRaises(CustomUploadAlreadyExists, self.process)
 
     def test_bad_umask(self):
-        # The umask must be 022 to avoid incorrect permissions.
+        # The umask must be 0o022 to avoid incorrect permissions.
         self.openArchive("20060302.0120")
         self.archive.add_file("20060302.0120/file", "foo")
-        os.umask(002)  # cleanup already handled by setUp
+        os.umask(0o002)  # cleanup already handled by setUp
         self.assertRaises(CustomUploadBadUmask, self.process)
 
     def test_current_symlink(self):

=== modified file 'lib/lp/archivepublisher/tests/test_publish_ftpmaster.py'
--- lib/lp/archivepublisher/tests/test_publish_ftpmaster.py	2016-02-04 19:46:52 +0000
+++ lib/lp/archivepublisher/tests/test_publish_ftpmaster.py	2016-02-05 16:55:09 +0000
@@ -320,7 +320,7 @@
         script_file = file(script_path, "w")
         script_file.write(script_code)
         script_file.close()
-        os.chmod(script_path, 0755)
+        os.chmod(script_path, 0o755)
 
     def test_script_runs_successfully(self):
         self.prepareUbuntu()

=== modified file 'lib/lp/archivepublisher/tests/test_uefi.py'
--- lib/lp/archivepublisher/tests/test_uefi.py	2012-11-09 12:50:09 +0000
+++ lib/lp/archivepublisher/tests/test_uefi.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2012-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test UEFI custom uploads."""
@@ -33,8 +33,8 @@
         self.uefi_dir = self.makeTemporaryDirectory()
         self.pubconf = FakeConfig(self.temp_dir, self.uefi_dir)
         self.suite = "distroseries"
-        # CustomUpload.installFiles requires a umask of 022.
-        old_umask = os.umask(022)
+        # CustomUpload.installFiles requires a umask of 0o022.
+        old_umask = os.umask(0o022)
         self.addCleanup(os.umask, old_umask)
 
     def setUpKeyAndCert(self):
@@ -97,11 +97,11 @@
         self.assertRaises(CustomUploadAlreadyExists, self.process)
 
     def test_bad_umask(self):
-        # The umask must be 022 to avoid incorrect permissions.
+        # The umask must be 0o022 to avoid incorrect permissions.
         self.setUpKeyAndCert()
         self.openArchive("test", "1.0", "amd64")
         self.archive.add_file("1.0/dir/file.efi", "foo")
-        os.umask(002)  # cleanup already handled by setUp
+        os.umask(0o002)  # cleanup already handled by setUp
         self.assertRaises(CustomUploadBadUmask, self.process)
 
     def test_correct_signing_command(self):

=== modified file 'lib/lp/archiveuploader/tests/test_dscfile.py'
--- lib/lp/archiveuploader/tests/test_dscfile.py	2015-07-29 01:59:43 +0000
+++ lib/lp/archiveuploader/tests/test_dscfile.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2014 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test dscfile.py"""
@@ -219,12 +219,12 @@
     def test_ReadOnlyCWD(self):
         """Processing a file should work when cwd is read-only."""
         tempdir = self.useTempDir()
-        os.chmod(tempdir, 0555)
+        os.chmod(tempdir, 0o555)
         try:
             dsc_file = self.getDscFile('bar_1.0-1')
             list(dsc_file.verify())
         finally:
-            os.chmod(tempdir, 0755)
+            os.chmod(tempdir, 0o755)
 
 
 class BaseTestSourceFileVerification(TestCase):
@@ -400,7 +400,7 @@
         os.mkdir(unpacked_dir)
         bar_path = os.path.join(unpacked_dir, "bar_1.0")
         os.mkdir(bar_path)
-        os.chmod(bar_path, 0600)
-        os.chmod(unpacked_dir, 0600)
+        os.chmod(bar_path, 0o600)
+        os.chmod(unpacked_dir, 0o600)
         cleanup_unpacked_dir(unpacked_dir)
         self.assertFalse(os.path.exists(unpacked_dir))

=== modified file 'lib/lp/bugs/doc/checkwatches-batching.txt'
--- lib/lp/bugs/doc/checkwatches-batching.txt	2010-10-18 22:24:59 +0000
+++ lib/lp/bugs/doc/checkwatches-batching.txt	2016-02-05 16:55:09 +0000
@@ -80,7 +80,7 @@
     ...         return remote_bug_ids[::2]
 
     >>> remote = QueryableRemoteSystem()
-    >>> now = datetime(2010, 01, 13, 16, 52, tzinfo=UTC)
+    >>> now = datetime(2010, 1, 13, 16, 52, tzinfo=UTC)
 
 When there are no bug watches to check, the result is empty, and the
 remote system is not queried.

=== modified file 'lib/lp/bugs/doc/externalbugtracker.txt'
--- lib/lp/bugs/doc/externalbugtracker.txt	2015-07-08 16:05:11 +0000
+++ lib/lp/bugs/doc/externalbugtracker.txt	2016-02-05 16:55:09 +0000
@@ -518,7 +518,7 @@
 will then be passed on to initializeRemoteBugDB().
 
     >>> some_time_ago = datetime(
-    ...     2007, 03, 17, 16, 00, tzinfo=pytz.timezone('UTC'))
+    ...     2007, 3, 17, 16, 0, tzinfo=pytz.timezone('UTC'))
     >>> for bug_watch in bug_watches:
     ...     bug_watch.lastchecked = some_time_ago
     >>> transaction.commit()

=== modified file 'lib/lp/bugs/stories/bugwatches/xx-edit-bugwatch.txt'
--- lib/lp/bugs/stories/bugwatches/xx-edit-bugwatch.txt	2013-05-09 08:53:01 +0000
+++ lib/lp/bugs/stories/bugwatches/xx-edit-bugwatch.txt	2016-02-05 16:55:09 +0000
@@ -71,7 +71,7 @@
     >>> login('foo.bar@xxxxxxxxxxxxx')
     >>> watch = getUtility(IBugWatchSet).get(2)
     >>> removeSecurityProxy(watch).next_check = datetime(
-    ...     2010, 4, 8, 16, 07, tzinfo=utc)
+    ...     2010, 4, 8, 16, 7, tzinfo=utc)
     >>> logout()
 
     >>> admin_browser.open('http://bugs.launchpad.dev/bugs/1/+watch/2')

=== modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipe.py'
--- lib/lp/code/browser/tests/test_sourcepackagerecipe.py	2016-01-20 12:21:21 +0000
+++ lib/lp/code/browser/tests/test_sourcepackagerecipe.py	2016-02-05 16:55:09 +0000
@@ -1200,10 +1200,10 @@
             recipe=recipe, distroseries=self.squirrel, archive=archive)
         build.updateStatus(
             BuildStatus.BUILDING,
-            date_started=datetime(2010, 03, 16, tzinfo=UTC))
+            date_started=datetime(2010, 3, 16, tzinfo=UTC))
         build.updateStatus(
             BuildStatus.FULLYBUILT,
-            date_finished=datetime(2010, 03, 16, tzinfo=UTC))
+            date_finished=datetime(2010, 3, 16, tzinfo=UTC))
         return build
 
     def test_index(self):
@@ -1290,10 +1290,10 @@
         binary_build.queueBuild()
         binary_build.updateStatus(
             BuildStatus.BUILDING,
-            date_started=datetime(2010, 04, 16, tzinfo=UTC))
+            date_started=datetime(2010, 4, 16, tzinfo=UTC))
         binary_build.updateStatus(
             BuildStatus.FULLYBUILT,
-            date_finished=datetime(2010, 04, 16, tzinfo=UTC))
+            date_finished=datetime(2010, 4, 16, tzinfo=UTC))
         binary_build.setLog(self.factory.makeLibraryFileAlias())
 
         self.assertTextMatchesExpressionIgnoreWhitespace("""\
@@ -1360,7 +1360,7 @@
         # We create builds in time ascending order (oldest first) since we
         # use id as the ordering attribute and lower ids mean created earlier.
         date_gen = time_counter(
-            datetime(2010, 03, 16, tzinfo=UTC), timedelta(days=1))
+            datetime(2010, 3, 16, tzinfo=UTC), timedelta(days=1))
         build1 = self.makeBuildJob(recipe, date_gen.next())
         build2 = self.makeBuildJob(recipe, date_gen.next())
         build3 = self.makeBuildJob(recipe, date_gen.next())

=== modified file 'lib/lp/code/feed/tests/test_revision.py'
--- lib/lp/code/feed/tests/test_revision.py	2012-01-01 02:58:52 +0000
+++ lib/lp/code/feed/tests/test_revision.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for the revision feeds."""
@@ -32,7 +32,7 @@
     def test_format(self):
         # The id contains the iso format of the date part of the revision
         # date, and the revision id.
-        revision_date = datetime(2009, 07, 21, 12, tzinfo=UTC)
+        revision_date = datetime(2009, 7, 21, 12, tzinfo=UTC)
         revision = self.factory.makeRevision(
             revision_date=revision_date, rev_id="test_revision_id")
         feed_id = revision_feed_id(revision)

=== modified file 'lib/lp/code/model/tests/test_gitjob.py'
--- lib/lp/code/model/tests/test_gitjob.py	2015-10-28 17:32:49 +0000
+++ lib/lp/code/model/tests/test_gitjob.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2015 Canonical Ltd.  This software is licensed under the
+# Copyright 2015-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for `GitJob`s."""
@@ -162,7 +162,7 @@
         job = GitRefScanJob.create(repository)
         paths = (u"refs/heads/master", u"refs/tags/1.0")
         author = repository.owner
-        author_date_start = datetime(2015, 01, 01, tzinfo=pytz.UTC)
+        author_date_start = datetime(2015, 1, 1, tzinfo=pytz.UTC)
         author_date_gen = time_counter(author_date_start, timedelta(days=1))
         hosting_client = FakeGitHostingClient(
             self.makeFakeRefs(paths),

=== modified file 'lib/lp/code/model/tests/test_gitrepository.py'
--- lib/lp/code/model/tests/test_gitrepository.py	2016-01-20 12:21:21 +0000
+++ lib/lp/code/model/tests/test_gitrepository.py	2016-02-05 16:55:09 +0000
@@ -724,7 +724,7 @@
         # When a GitRepository receives an object modified event, the last
         # modified date is set to UTC_NOW.
         repository = self.factory.makeGitRepository(
-            date_created=datetime(2015, 02, 04, 17, 42, 0, tzinfo=pytz.UTC))
+            date_created=datetime(2015, 2, 4, 17, 42, 0, tzinfo=pytz.UTC))
         notify(ObjectModifiedEvent(
             removeSecurityProxy(repository), repository,
             [IGitRepository["name"]], user=repository.owner))
@@ -733,7 +733,7 @@
 
     def test_create_ref_sets_date_last_modified(self):
         repository = self.factory.makeGitRepository(
-            date_created=datetime(2015, 06, 01, tzinfo=pytz.UTC))
+            date_created=datetime(2015, 6, 1, tzinfo=pytz.UTC))
         [ref] = self.factory.makeGitRefs(repository=repository)
         new_refs_info = {
             ref.path: {
@@ -747,7 +747,7 @@
 
     def test_update_ref_sets_date_last_modified(self):
         repository = self.factory.makeGitRepository(
-            date_created=datetime(2015, 06, 01, tzinfo=pytz.UTC))
+            date_created=datetime(2015, 6, 1, tzinfo=pytz.UTC))
         [ref] = self.factory.makeGitRefs(repository=repository)
         new_refs_info = {
             u"refs/heads/new": {
@@ -761,7 +761,7 @@
 
     def test_remove_ref_sets_date_last_modified(self):
         repository = self.factory.makeGitRepository(
-            date_created=datetime(2015, 06, 01, tzinfo=pytz.UTC))
+            date_created=datetime(2015, 6, 1, tzinfo=pytz.UTC))
         [ref] = self.factory.makeGitRefs(repository=repository)
         repository.removeRefs(set([ref.path]))
         self.assertSqlAttributeEqualsDate(

=== modified file 'lib/lp/code/xmlrpc/tests/test_codehosting.py'
--- lib/lp/code/xmlrpc/tests/test_codehosting.py	2015-10-19 10:56:16 +0000
+++ lib/lp/code/xmlrpc/tests/test_codehosting.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for the internal codehosting API."""
@@ -230,8 +230,8 @@
 
     def test_recordSuccess(self):
         # recordSuccess must insert the given data into ScriptActivity.
-        started = datetime.datetime(2007, 07, 05, 19, 32, 1, tzinfo=UTC)
-        completed = datetime.datetime(2007, 07, 05, 19, 34, 24, tzinfo=UTC)
+        started = datetime.datetime(2007, 7, 5, 19, 32, 1, tzinfo=UTC)
+        completed = datetime.datetime(2007, 7, 5, 19, 34, 24, tzinfo=UTC)
         started_tuple = tuple(started.utctimetuple())
         completed_tuple = tuple(completed.utctimetuple())
         success = self.codehosting_api.recordSuccess(

=== modified file 'lib/lp/codehosting/codeimport/tests/servers.py'
--- lib/lp/codehosting/codeimport/tests/servers.py	2012-09-06 09:25:47 +0000
+++ lib/lp/codehosting/codeimport/tests/servers.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Server classes that know how to create various kinds of foreign archive."""
@@ -277,7 +277,7 @@
             in tree_contents]
         repo.object_store.add_objects(blobs)
         root_id = dulwich.index.commit_tree(repo.object_store, [
-            (filename, b.id, stat.S_IFREG | 0644)
+            (filename, b.id, stat.S_IFREG | 0o644)
             for (b, filename) in blobs])
         repo.do_commit(committer='Joe Foo <joe@xxxxxxx>',
             message=u'<The commit message>', tree=root_id)

=== modified file 'lib/lp/codehosting/tests/servers.py'
--- lib/lp/codehosting/tests/servers.py	2012-08-14 23:27:07 +0000
+++ lib/lp/codehosting/tests/servers.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Server used in codehosting acceptance tests."""
@@ -67,7 +67,7 @@
         """Clear the branch areas."""
         if os.path.isdir(self._mirror_root):
             shutil.rmtree(self._mirror_root)
-        os.makedirs(self._mirror_root, 0700)
+        os.makedirs(self._mirror_root, 0o700)
 
     def setUpRoot(self):
         self.clear()
@@ -112,7 +112,7 @@
         shutil.copyfile(
             sibpath(__file__, 'id_dsa.pub'),
             os.path.join(user_home, '.ssh', 'id_dsa.pub'))
-        os.chmod(os.path.join(user_home, '.ssh', 'id_dsa'), 0600)
+        os.chmod(os.path.join(user_home, '.ssh', 'id_dsa'), 0o600)
         real_home, os.environ['HOME'] = os.environ['HOME'], user_home
         return real_home, user_home
 

=== modified file 'lib/lp/codehosting/tests/test_sftp.py'
--- lib/lp/codehosting/tests/test_sftp.py	2015-01-06 12:47:59 +0000
+++ lib/lp/codehosting/tests/test_sftp.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for the transport-backed SFTP server implementation."""
@@ -138,7 +138,7 @@
         branch_name = self.factory.getUniqueString()
         deferred = server.makeDirectory(
             '~%s/%s/%s' % (avatar.username, product.name, branch_name),
-            {'permissions': 0777})
+            {'permissions': 0o777})
         return deferred
 
 
@@ -507,12 +507,12 @@
         # makeDirectory makes the directory.
         directory = self.getPathSegment()
         deferred = self.sftp_server.makeDirectory(
-            directory, {'permissions': 0777})
+            directory, {'permissions': 0o777})
 
         def assertDirectoryExists(ignored):
             self.assertTrue(
                 os.path.isdir(directory), '%r is not a directory' % directory)
-            self.assertEqual(040777, os.stat(directory).st_mode)
+            self.assertEqual(0o40777, os.stat(directory).st_mode)
 
         return deferred.addCallback(assertDirectoryExists)
 
@@ -521,7 +521,7 @@
         nonexistent = self.getPathSegment()
         nonexistent_child = '%s/%s' % (nonexistent, self.getPathSegment())
         deferred = self.sftp_server.makeDirectory(
-            nonexistent_child, {'permissions': 0777})
+            nonexistent_child, {'permissions': 0o777})
         return assert_fails_with(deferred, filetransfer.SFTPError)
 
     def test_removeDirectory(self):

=== modified file 'lib/lp/hardwaredb/doc/hwdb.txt'
--- lib/lp/hardwaredb/doc/hwdb.txt	2016-01-26 15:47:37 +0000
+++ lib/lp/hardwaredb/doc/hwdb.txt	2016-02-05 16:55:09 +0000
@@ -159,8 +159,8 @@
     ...     HWSubmissionFormat,
     ...     IHWSubmissionSet,
     ...     )
-    >>> date_created = datetime(2007, 04, 01, tzinfo=pytz.timezone('UTC'))
-    >>> date_submitted = datetime(2007, 04, 02, tzinfo=pytz.timezone('UTC'))
+    >>> date_created = datetime(2007, 4, 1, tzinfo=pytz.timezone('UTC'))
+    >>> date_submitted = datetime(2007, 4, 2, tzinfo=pytz.timezone('UTC'))
     >>> submission_data = 'submission data'
     >>> hw_submission_set = getUtility(IHWSubmissionSet)
     >>> submission = hw_submission_set.createSubmission(

=== modified file 'lib/lp/registry/browser/tests/productseries-views.txt'
--- lib/lp/registry/browser/tests/productseries-views.txt	2012-11-08 03:55:11 +0000
+++ lib/lp/registry/browser/tests/productseries-views.txt	2016-02-05 16:55:09 +0000
@@ -214,7 +214,7 @@
     >>> from lp.app.interfaces.launchpad import ILaunchpadCelebrities
     >>> celebrities = getUtility(ILaunchpadCelebrities)
 
-    >>> test_date = datetime(2009, 05, 01, 19, 34, 24, tzinfo=UTC)
+    >>> test_date = datetime(2009, 5, 1, 19, 34, 24, tzinfo=UTC)
     >>> product = factory.makeProduct(name="field", displayname='Field')
     >>> productseries = factory.makeProductSeries(
     ...     product=product, name='rabbit', date_created=test_date)

=== modified file 'lib/lp/registry/browser/tests/test_announcements.py'
--- lib/lp/registry/browser/tests/test_announcements.py	2012-01-01 02:58:52 +0000
+++ lib/lp/registry/browser/tests/test_announcements.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2011-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for +announcement views."""
@@ -36,7 +36,7 @@
     def test_announcement_info_with_publication_date(self):
         product = self.factory.makeProduct(displayname=u"Foo")
         announcer = self.factory.makePerson(displayname=u"Bar Baz")
-        announced = datetime(2007, 01, 12, tzinfo=utc)
+        announced = datetime(2007, 1, 12, tzinfo=utc)
         announcement = product.announce(
             announcer, "Hello World", publication_date=announced)
         view = create_initialized_view(announcement, "+index")

=== modified file 'lib/lp/registry/doc/distribution-mirror.txt'
--- lib/lp/registry/doc/distribution-mirror.txt	2016-01-26 15:47:37 +0000
+++ lib/lp/registry/doc/distribution-mirror.txt	2016-02-05 16:55:09 +0000
@@ -576,8 +576,8 @@
     ...     warty.components[0])
     >>> warty_i386_mirror = removeSecurityProxy(warty_i386_mirror)
     >>> recent_freshness, threshold = warty_i386_mirror.freshness_times[0]
-    >>> start = datetime(2005, 06, 20, tzinfo=utc)
-    >>> end = datetime(2005, 06, 20, tzinfo=utc) + timedelta(hours=0.5)
+    >>> start = datetime(2005, 6, 20, tzinfo=utc)
+    >>> end = datetime(2005, 6, 20, tzinfo=utc) + timedelta(hours=0.5)
     >>> time_interval = (start, end)
     >>> upload = warty_i386_mirror.getLatestPublishingEntry(
     ...     time_interval, deb_only=False)

=== modified file 'lib/lp/registry/doc/poll.txt'
--- lib/lp/registry/doc/poll.txt	2011-12-30 06:14:56 +0000
+++ lib/lp/registry/doc/poll.txt	2016-02-05 16:55:09 +0000
@@ -39,7 +39,7 @@
   >>> pollsubset = IPollSubset(team)
 
 Now we create a new poll on this team.
-  >>> opendate = datetime(2005, 01, 01, tzinfo=pytz.timezone('UTC'))
+  >>> opendate = datetime(2005, 1, 1, tzinfo=pytz.timezone('UTC'))
   >>> closedate = opendate + timedelta(weeks=2)
   >>> title = "2005 Leader's Elections"
   >>> proposition = "Who's going to be the next leader?"

=== modified file 'lib/lp/registry/stories/gpg-coc/xx-gpg-coc.txt'
--- lib/lp/registry/stories/gpg-coc/xx-gpg-coc.txt	2016-01-26 15:47:37 +0000
+++ lib/lp/registry/stories/gpg-coc/xx-gpg-coc.txt	2016-02-05 16:55:09 +0000
@@ -214,7 +214,7 @@
     >>> logintoken = LoginToken.selectOneBy(
     ...     _token=hashlib.sha256(token_value).hexdigest())
     >>> logintoken.date_created = datetime.datetime(
-    ...     2005,04,01, 12,00,00, tzinfo=pytz.timezone('UTC'))
+    ...     2005, 4, 1, 12, 0, 0, tzinfo=pytz.timezone('UTC'))
     >>> logintoken.sync()
 
 Back to Sample User. They visit the token URL and is asked to sign some

=== modified file 'lib/lp/registry/tests/test_distributionmirror_prober.py'
--- lib/lp/registry/tests/test_distributionmirror_prober.py	2015-02-18 18:44:32 +0000
+++ lib/lp/registry/tests/test_distributionmirror_prober.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2015 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """distributionmirror-prober tests."""
@@ -930,7 +930,7 @@
 
     def _fake_gettime(self):
         # Fake the current time.
-        fake_time = datetime(2004, 10, 20, 12, 00, 00, 000000)
+        fake_time = datetime(2004, 10, 20, 12, 0, 0, 0)
         return fake_time
 
     def test_logMessage_output(self):

=== modified file 'lib/lp/scripts/runlaunchpad.py'
--- lib/lp/scripts/runlaunchpad.py	2014-01-06 06:52:41 +0000
+++ lib/lp/scripts/runlaunchpad.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2014 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __metaclass__ = type
@@ -273,7 +273,7 @@
 
 def prepare_for_librarian():
     if not os.path.isdir(config.librarian_server.root):
-        os.makedirs(config.librarian_server.root, 0700)
+        os.makedirs(config.librarian_server.root, 0o700)
 
 
 SERVICES = {

=== modified file 'lib/lp/scripts/tests/test_garbo.py'
--- lib/lp/scripts/tests/test_garbo.py	2015-12-15 15:58:49 +0000
+++ lib/lp/scripts/tests/test_garbo.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2015 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test the database garbage collector."""
@@ -735,7 +735,7 @@
         self.factory.makePerson(name='test-unlinked-person-new')
         person_old = self.factory.makePerson(name='test-unlinked-person-old')
         removeSecurityProxy(person_old).datecreated = datetime(
-            2008, 01, 01, tzinfo=UTC)
+            2008, 1, 1, tzinfo=UTC)
 
         # Normally, the garbage collector will do nothing because the
         # PersonPruner is experimental
@@ -1030,7 +1030,7 @@
             path="sample path"))))
         # One to clean and one to keep
         store.add(TimeLimitedToken(path="sample path", token="foo",
-            created=datetime(2008, 01, 01, tzinfo=UTC)))
+            created=datetime(2008, 1, 1, tzinfo=UTC)))
         store.add(TimeLimitedToken(path="sample path", token="bar")),
         store.commit()
         self.assertEqual(2, len(list(store.find(TimeLimitedToken,

=== modified file 'lib/lp/services/librarianserver/testing/server.py'
--- lib/lp/services/librarianserver/testing/server.py	2012-02-28 05:36:01 +0000
+++ lib/lp/services/librarianserver/testing/server.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Fixture for the librarians."""
@@ -130,7 +130,7 @@
             root_fixture = FunctionFixture(tempfile.mkdtemp, shutil.rmtree)
             self.useFixture(root_fixture)
             self._root = root_fixture.fn_result
-            os.chmod(self.root, 0700)
+            os.chmod(self.root, 0o700)
             # Give the root to the new librarian.
             os.environ['LP_LIBRARIAN_ROOT'] = self._root
         else:
@@ -139,7 +139,7 @@
             if os.path.exists(self.root):
                 self.tearDownRoot()
             self.addCleanup(self.tearDownRoot)
-            os.makedirs(self.root, 0700)
+            os.makedirs(self.root, 0o700)
 
     def _waitForDaemonStartup(self):
         super(LibrarianServerFixture, self)._waitForDaemonStartup()

=== modified file 'lib/lp/services/librarianserver/tests/test_web.py'
--- lib/lp/services/librarianserver/tests/test_web.py	2015-12-27 03:42:08 +0000
+++ lib/lp/services/librarianserver/tests/test_web.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 from cStringIO import StringIO
@@ -223,7 +223,7 @@
         file_alias = IMasterStore(LibraryFileAlias).get(
             LibraryFileAlias, file_alias_id)
         file_alias.date_created = datetime(
-            2001, 01, 30, 13, 45, 59, tzinfo=pytz.utc)
+            2001, 1, 30, 13, 45, 59, tzinfo=pytz.utc)
 
         # Commit so the file is available from the Librarian.
         self.commit()
@@ -419,7 +419,7 @@
         file_alias = IMasterStore(LibraryFileAlias).get(
             LibraryFileAlias, fileAlias)
         file_alias.date_created = datetime(
-            2001, 01, 30, 13, 45, 59, tzinfo=pytz.utc)
+            2001, 1, 30, 13, 45, 59, tzinfo=pytz.utc)
         # Commit the update.
         self.commit()
         # Fetch the file via HTTP, recording the interesting headers

=== modified file 'lib/lp/services/osutils.py'
--- lib/lp/services/osutils.py	2012-12-26 02:03:56 +0000
+++ lib/lp/services/osutils.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Utilities for doing the sort of thing the os module does."""
@@ -64,7 +64,7 @@
         set_environ(old_values)
 
 
-def ensure_directory_exists(directory, mode=0777):
+def ensure_directory_exists(directory, mode=0o777):
     """Create 'directory' if it doesn't exist.
 
     :return: True if the directory had to be created, False otherwise.
@@ -78,7 +78,7 @@
     return True
 
 
-def open_for_writing(filename, mode, dirmode=0777):
+def open_for_writing(filename, mode, dirmode=0o777):
     """Open 'filename' for writing, creating directories if necessary.
 
     :param filename: The path of the file to open.

=== modified file 'lib/lp/services/tarfile_helpers.py'
--- lib/lp/services/tarfile_helpers.py	2012-05-25 13:22:27 +0000
+++ lib/lp/services/tarfile_helpers.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Helpers to work with tar files more easily."""
@@ -87,7 +87,7 @@
             except KeyError:
                 tarinfo = self._make_skeleton_tarinfo(joined_path, now)
                 tarinfo.type = tarfile.DIRTYPE
-                tarinfo.mode = 0755
+                tarinfo.mode = 0o755
                 self.tarfile.addfile(tarinfo)
 
     def add_directory(self, path):
@@ -105,7 +105,7 @@
         self._ensure_directories(path, now)
 
         tarinfo = self._make_skeleton_tarinfo(path, now)
-        tarinfo.mode = 0644
+        tarinfo.mode = 0o644
         tarinfo.size = len(contents)
         self.tarfile.addfile(tarinfo, StringIO(contents))
 

=== modified file 'lib/lp/services/webapp/tests/test_batching.py'
--- lib/lp/services/webapp/tests/test_batching.py	2015-10-01 10:25:19 +0000
+++ lib/lp/services/webapp/tests/test_batching.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2011-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __metaclass__ = type
@@ -395,7 +395,7 @@
         range_factory = StormRangeFactory(resultset, self.logError)
         order_by = [
             Person.id, Person.datecreated, Person.name, Person.display_name]
-        limits = [1, datetime(2011, 07, 25, 0, 0, 0), 'foo', 'bar']
+        limits = [1, datetime(2011, 7, 25, 0, 0, 0), 'foo', 'bar']
         result = range_factory.limitsGroupedByOrderDirection(order_by, limits)
         self.assertEqual([(order_by, limits)], result)
         order_by = [
@@ -443,7 +443,7 @@
             Person.id, Person.datecreated, Desc(Person.name),
             Desc(Person.display_name)]
         limits = [
-            1, datetime(2011, 07, 25, 0, 0, 0, tzinfo=pytz.UTC), 'foo', 'bar']
+            1, datetime(2011, 7, 25, 0, 0, 0, tzinfo=pytz.UTC), 'foo', 'bar']
         limits = range_factory.limitsGroupedByOrderDirection(order_by, limits)
         equals_expressions = range_factory.equalsExpressionsFromLimits(limits)
         equals_expressions = map(compile, equals_expressions)

=== modified file 'lib/lp/snappy/tests/test_snapbuild.py'
--- lib/lp/snappy/tests/test_snapbuild.py	2016-02-04 00:45:12 +0000
+++ lib/lp/snappy/tests/test_snapbuild.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2015 Canonical Ltd.  This software is licensed under the
+# Copyright 2015-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test snap package build features."""
@@ -238,7 +238,7 @@
         build = self.factory.makeSnapBuild(
             name=u"snap-1", requester=person, owner=person,
             distroarchseries=distroarchseries,
-            date_created=datetime(2014, 04, 25, 10, 38, 0, tzinfo=pytz.UTC),
+            date_created=datetime(2014, 4, 25, 10, 38, 0, tzinfo=pytz.UTC),
             status=BuildStatus.FAILEDTOBUILD,
             builder=self.factory.makeBuilder(name="bob"),
             duration=timedelta(minutes=10))
@@ -332,7 +332,7 @@
         # The basic properties of a SnapBuild are sensible.
         db_build = self.factory.makeSnapBuild(
             requester=self.person,
-            date_created=datetime(2014, 04, 25, 10, 38, 0, tzinfo=pytz.UTC))
+            date_created=datetime(2014, 4, 25, 10, 38, 0, tzinfo=pytz.UTC))
         build_url = api_url(db_build)
         logout()
         build = self.webservice.get(build_url).jsonBody()

=== modified file 'lib/lp/soyuz/model/queue.py'
--- lib/lp/soyuz/model/queue.py	2016-01-26 15:47:37 +0000
+++ lib/lp/soyuz/model/queue.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2015 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __metaclass__ = type
@@ -1444,7 +1444,7 @@
         dest_file = os.path.join(
             archive_config.metaroot, self.libraryfilealias.filename)
         if not os.path.isdir(archive_config.metaroot):
-            os.makedirs(archive_config.metaroot, 0755)
+            os.makedirs(archive_config.metaroot, 0o755)
 
         # At this point we now have a directory of the format:
         # <person_name>/meta/<ppa_name>

=== modified file 'lib/lp/soyuz/tests/test_binarypackagename.py'
--- lib/lp/soyuz/tests/test_binarypackagename.py	2012-09-26 08:12:48 +0000
+++ lib/lp/soyuz/tests/test_binarypackagename.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test BinaryPackageName."""
@@ -169,10 +169,10 @@
         name = self.factory.makeBinaryPackageName()
         self.factory.makeBinaryPackageRelease(
             binarypackagename=name, description="foo",
-            date_created=datetime(1980, 01, 01, tzinfo=pytz.UTC))
+            date_created=datetime(1980, 1, 1, tzinfo=pytz.UTC))
         self.factory.makeBinaryPackageRelease(
             binarypackagename=name, description="bar",
-            date_created=datetime(2000, 01, 01, tzinfo=pytz.UTC))
+            date_created=datetime(2000, 1, 1, tzinfo=pytz.UTC))
         self.assertEqual(
             {name.name: "bar"},
             getBinaryPackageDescriptions([name], max_title_length=3))

=== modified file 'lib/lp/soyuz/tests/test_build.py'
--- lib/lp/soyuz/tests/test_build.py	2015-09-11 12:21:16 +0000
+++ lib/lp/soyuz/tests/test_build.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2011-2015 Canonical Ltd.  This software is licensed under the
+# Copyright 2011-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __metaclass__ = type
@@ -112,10 +112,10 @@
         self.assertEquals(
             PackageUploadStatus.DONE, build.package_upload.status)
         self.assertEquals(
-            datetime(2008, 01, 01, 0, 0, 0, tzinfo=pytz.UTC),
+            datetime(2008, 1, 1, 0, 0, 0, tzinfo=pytz.UTC),
             build.date_started)
         self.assertEquals(
-            datetime(2008, 01, 01, 0, 5, 0, tzinfo=pytz.UTC),
+            datetime(2008, 1, 1, 0, 5, 0, tzinfo=pytz.UTC),
             build.date_finished)
         self.assertEquals(timedelta(minutes=5), build.duration)
         expected_buildlog = 'buildlog_%s-%s-%s.%s_%s_FULLYBUILT.txt.gz' % (

=== modified file 'lib/lp/soyuz/tests/test_distroseriesqueue_ddtp_tarball.py'
--- lib/lp/soyuz/tests/test_distroseriesqueue_ddtp_tarball.py	2012-07-02 16:11:15 +0000
+++ lib/lp/soyuz/tests/test_distroseriesqueue_ddtp_tarball.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2012-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test upload and queue manipulation of DDTP tarballs.
@@ -36,8 +36,8 @@
     def setUp(self):
         super(TestDistroSeriesQueueDdtpTarball, self).setUp()
         import_public_test_keys()
-        # CustomUpload.installFiles requires a umask of 022.
-        old_umask = os.umask(022)
+        # CustomUpload.installFiles requires a umask of 0o022.
+        old_umask = os.umask(0o022)
         self.addCleanup(os.umask, old_umask)
         self.anything_policy = getPolicy(
             name="anything", distro="ubuntutest", distroseries=None)

=== modified file 'lib/lp/soyuz/tests/test_distroseriesqueue_debian_installer.py'
--- lib/lp/soyuz/tests/test_distroseriesqueue_debian_installer.py	2015-08-26 13:41:21 +0000
+++ lib/lp/soyuz/tests/test_distroseriesqueue_debian_installer.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2012-2015 Canonical Ltd.  This software is licensed under the
+# Copyright 2012-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test upload and queue manipulation of debian-installer custom uploads.
@@ -29,8 +29,8 @@
     def setUp(self):
         super(TestDistroSeriesQueueDebianInstaller, self).setUp()
         import_public_test_keys()
-        # CustomUpload.installFiles requires a umask of 022.
-        old_umask = os.umask(022)
+        # CustomUpload.installFiles requires a umask of 0o022.
+        old_umask = os.umask(0o022)
         self.addCleanup(os.umask, old_umask)
         self.anything_policy = getPolicy(
             name="anything", distro="ubuntutest", distroseries=None)

=== modified file 'lib/lp/soyuz/tests/test_distroseriesqueue_dist_upgrader.py'
--- lib/lp/soyuz/tests/test_distroseriesqueue_dist_upgrader.py	2015-09-02 12:05:15 +0000
+++ lib/lp/soyuz/tests/test_distroseriesqueue_dist_upgrader.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2012-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test upload and queue manipulation of dist-upgrader tarballs.
@@ -32,8 +32,8 @@
     def setUp(self):
         super(TestDistroSeriesQueueDistUpgrader, self).setUp()
         import_public_test_keys()
-        # CustomUpload.installFiles requires a umask of 022.
-        old_umask = os.umask(022)
+        # CustomUpload.installFiles requires a umask of 0o022.
+        old_umask = os.umask(0o022)
         self.addCleanup(os.umask, old_umask)
         self.anything_policy = getPolicy(
             name="anything", distro="ubuntutest", distroseries=None)

=== modified file 'lib/lp/soyuz/tests/test_livefs.py'
--- lib/lp/soyuz/tests/test_livefs.py	2015-09-15 20:16:47 +0000
+++ lib/lp/soyuz/tests/test_livefs.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2014-2015 Canonical Ltd.  This software is licensed under the
+# Copyright 2014-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test live filesystems."""
@@ -96,14 +96,14 @@
     def test_initial_date_last_modified(self):
         # The initial value of date_last_modified is date_created.
         livefs = self.factory.makeLiveFS(
-            date_created=datetime(2014, 04, 25, 10, 38, 0, tzinfo=pytz.UTC))
+            date_created=datetime(2014, 4, 25, 10, 38, 0, tzinfo=pytz.UTC))
         self.assertEqual(livefs.date_created, livefs.date_last_modified)
 
     def test_modifiedevent_sets_date_last_modified(self):
         # When a LiveFS receives an object modified event, the last modified
         # date is set to UTC_NOW.
         livefs = self.factory.makeLiveFS(
-            date_created=datetime(2014, 04, 25, 10, 38, 0, tzinfo=pytz.UTC))
+            date_created=datetime(2014, 4, 25, 10, 38, 0, tzinfo=pytz.UTC))
         notify(ObjectModifiedEvent(
             removeSecurityProxy(livefs), livefs, [ILiveFS["name"]]))
         self.assertSqlAttributeEqualsDate(

=== modified file 'lib/lp/soyuz/tests/test_livefsbuild.py'
--- lib/lp/soyuz/tests/test_livefsbuild.py	2015-09-11 12:20:23 +0000
+++ lib/lp/soyuz/tests/test_livefsbuild.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2014-2015 Canonical Ltd.  This software is licensed under the
+# Copyright 2014-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test live filesystem build features."""
@@ -240,7 +240,7 @@
         build = self.factory.makeLiveFSBuild(
             name=u"livefs-1", requester=person, owner=person,
             distroarchseries=distroarchseries,
-            date_created=datetime(2014, 04, 25, 10, 38, 0, tzinfo=pytz.UTC),
+            date_created=datetime(2014, 4, 25, 10, 38, 0, tzinfo=pytz.UTC),
             status=BuildStatus.FAILEDTOBUILD,
             builder=self.factory.makeBuilder(name="bob"),
             duration=timedelta(minutes=10))
@@ -338,7 +338,7 @@
         db_build = self.factory.makeLiveFSBuild(
             requester=self.person, unique_key=u"foo",
             metadata_override={"image_format": "plain"},
-            date_created=datetime(2014, 04, 25, 10, 38, 0, tzinfo=pytz.UTC))
+            date_created=datetime(2014, 4, 25, 10, 38, 0, tzinfo=pytz.UTC))
         build_url = api_url(db_build)
         logout()
         build = self.webservice.get(build_url).jsonBody()

=== modified file 'lib/lp/soyuz/tests/test_livefsbuildbehaviour.py'
--- lib/lp/soyuz/tests/test_livefsbuildbehaviour.py	2015-10-21 09:37:08 +0000
+++ lib/lp/soyuz/tests/test_livefsbuildbehaviour.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2014 Canonical Ltd.  This software is licensed under the
+# Copyright 2014-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test live filesystem build behaviour."""
@@ -160,7 +160,7 @@
     def test_extraBuildArgs(self):
         # _extraBuildArgs returns a reasonable set of additional arguments.
         job = self.makeJob(
-            date_created=datetime(2014, 04, 25, 10, 38, 0, tzinfo=pytz.UTC),
+            date_created=datetime(2014, 4, 25, 10, 38, 0, tzinfo=pytz.UTC),
             metadata={"project": "distro", "subproject": "special"})
         expected_archives = get_sources_list_for_building(
             job.build, job.build.distro_arch_series, None)

=== modified file 'lib/lp/testing/tests/test_factory.py'
--- lib/lp/testing/tests/test_factory.py	2013-06-20 05:50:00 +0000
+++ lib/lp/testing/tests/test_factory.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2013 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for the Launchpad object factory."""
@@ -326,7 +326,7 @@
         self.assertEqual(110, bpr.installedsize)
 
     def test_makeBinaryPackageName_uses_date_created(self):
-        date_created = datetime(2000, 01, 01, tzinfo=pytz.UTC)
+        date_created = datetime(2000, 1, 1, tzinfo=pytz.UTC)
         bpr = self.factory.makeBinaryPackageRelease(
             date_created=date_created)
         self.assertEqual(date_created, bpr.datecreated)

=== modified file 'lib/lp/translations/browser/tests/test_translationmessage_view.py'
--- lib/lp/translations/browser/tests/test_translationmessage_view.py	2014-06-10 11:25:51 +0000
+++ lib/lp/translations/browser/tests/test_translationmessage_view.py	2016-02-05 16:55:09 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2014 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 from __future__ import with_statement
@@ -329,7 +329,7 @@
         view = self._makeView()
         view.request.form['lock_timestamp'] = u'2010-01-01 00:00:00 UTC'
         self.assertEqual(
-            datetime(2010, 01, 01, tzinfo=pytz.utc),
+            datetime(2010, 1, 1, tzinfo=pytz.utc),
             view._extractLockTimestamp())
 
     def test_extractLockTimestamp_returns_None_by_default(self):

=== modified file 'lib/lp/translations/doc/poexport-language-pack.txt'
--- lib/lp/translations/doc/poexport-language-pack.txt	2015-01-16 16:44:27 +0000
+++ lib/lp/translations/doc/poexport-language-pack.txt	2016-02-05 16:55:09 +0000
@@ -91,8 +91,8 @@
 Directory permissions allow correct use of those directories:
 
     >>> directory = tarfile.getmember('rosetta-hoary')
-    >>> oct(directory.mode)
-    '0755'
+    >>> '0o%o' % directory.mode
+    '0o755'
 
 And one of the included .po files look like what we expected.
 


Follow ups