launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #26236
[Merge] ~cjwatson/launchpad:py3-ignore-seek-write-return into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-ignore-seek-write-return into launchpad:master.
Commit message:
Ignore return values from IOBase.seek and RawIOBase.write
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/397617
On Python 2, file.seek and file.write returned None, but Python 3's equivalents return a bit more information.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-ignore-seek-write-return into launchpad:master.
diff --git a/lib/lp/app/doc/launchpadform.txt b/lib/lp/app/doc/launchpadform.txt
index 86a5fc3..e02851b 100644
--- a/lib/lp/app/doc/launchpadform.txt
+++ b/lib/lp/app/doc/launchpadform.txt
@@ -475,7 +475,7 @@ template and thus is way simpler.
>>> from zope.browserpage import ViewPageTemplateFile
>>> file, filename = mkstemp()
>>> f = open(filename, 'w')
- >>> f.write(u'<div metal:use-macro="context/@@launchpad_form/form" />')
+ >>> _ = f.write(u'<div metal:use-macro="context/@@launchpad_form/form" />')
>>> f.close()
By default, all widgets are visible.
diff --git a/lib/lp/app/doc/menus.txt b/lib/lp/app/doc/menus.txt
index e50330a..a084296 100644
--- a/lib/lp/app/doc/menus.txt
+++ b/lib/lp/app/doc/menus.txt
@@ -1094,7 +1094,7 @@ NavigationMenus used in the previous TALES section.
>>> from lp.services.webapp.menu import (
... get_facet, get_current_view)
- >>> menu_fragement = """\
+ >>> menu_fragment = """\
... <div>
... <label
... tal:condition="view/title|nothing"
@@ -1114,7 +1114,7 @@ NavigationMenus used in the previous TALES section.
... </ul>
... </div>"""
>>> template_file = tempfile.NamedTemporaryFile()
- >>> template_file.write(menu_fragement)
+ >>> _ = template_file.write(menu_fragment)
>>> template_file.flush()
>>> class FacetMenuView(LaunchpadView):
diff --git a/lib/lp/app/stories/basics/xx-maintenance-message.txt b/lib/lp/app/stories/basics/xx-maintenance-message.txt
index 5f66dca..51a2a7f 100644
--- a/lib/lp/app/stories/basics/xx-maintenance-message.txt
+++ b/lib/lp/app/stories/basics/xx-maintenance-message.txt
@@ -74,7 +74,7 @@ When the time is in the past, the time is still given as "very very soon".
If the time doesn't make sense, or is empty, then no message is displayed.
>>> with open('+maintenancetime.txt', 'w') as f:
- ... f.write('xxxx')
+ ... _ = f.write('xxxx')
>>> content = front_page_content()
>>> okay200 in content
True
@@ -82,7 +82,7 @@ If the time doesn't make sense, or is empty, then no message is displayed.
True
>>> with open('+maintenancetime.txt', 'w') as f:
- ... f.write('')
+ ... _ = f.write('')
>>> content = front_page_content()
>>> okay200 in content
True
diff --git a/lib/lp/app/stories/folder.txt b/lib/lp/app/stories/folder.txt
index ee9d9db..91ec29f 100644
--- a/lib/lp/app/stories/folder.txt
+++ b/lib/lp/app/stories/folder.txt
@@ -13,14 +13,14 @@ the directory to expose.
>>> import tempfile
>>> resource_dir = tempfile.mkdtemp(prefix='resources')
>>> with open(os.path.join(resource_dir, 'test.txt'), 'w') as f:
- ... f.write('Text file')
+ ... _ = f.write('Text file')
>>> with open(os.path.join(resource_dir, 'image1.gif'), 'w') as f:
- ... f.write('GIF file')
+ ... _ = f.write('GIF file')
>>> with open(os.path.join(resource_dir, 'image2.png'), 'w') as f:
- ... f.write('PNG file')
+ ... _ = f.write('PNG file')
>>> os.mkdir(os.path.join(resource_dir, 'a_dir'))
>>> with open(os.path.join(resource_dir, 'other.txt'), 'w') as f:
- ... f.write('Other file')
+ ... _ = f.write('Other file')
>>> from lp.app.browser.folder import ExportedFolder
>>> class MyFolder(ExportedFolder):
@@ -125,9 +125,9 @@ image_extensions property.
If a file without extension exists, that one will be served.
>>> with open(os.path.join(resource_dir, 'image3'), 'w') as f:
- ... f.write('Image without extension')
+ ... _ = f.write('Image without extension')
>>> with open(os.path.join(resource_dir, 'image3.gif'), 'w') as f:
- ... f.write('Image with extension')
+ ... _ = f.write('Image with extension')
>>> view = MyImageFolder(object(), FakeRequest(version="devel"))
>>> view = view.publishTraverse(view.request, 'image3')
@@ -149,11 +149,11 @@ subdirectories.
>>> os.mkdir(os.path.join(resource_dir, 'public'))
>>> with open(os.path.join(
... resource_dir, 'public', 'test1.txt'), 'w') as f:
- ... f.write('Public File')
+ ... _ = f.write('Public File')
>>> os.mkdir(os.path.join(resource_dir, 'public', 'subdir1'))
>>> with open(os.path.join(
... resource_dir, 'public', 'subdir1', 'test1.txt'), 'w') as f:
- ... f.write('Sub file 1')
+ ... _ = f.write('Sub file 1')
>>> class MyTree(ExportedFolder):
... folder = resource_dir
diff --git a/lib/lp/archivepublisher/tests/archive-signing.txt b/lib/lp/archivepublisher/tests/archive-signing.txt
index a4a7c7f..d61bd69 100644
--- a/lib/lp/archivepublisher/tests/archive-signing.txt
+++ b/lib/lp/archivepublisher/tests/archive-signing.txt
@@ -398,7 +398,7 @@ file contents, and a clearsigned InRelease file.
>>> release_path = os.path.join(suite_path, 'Release')
>>> release_file = open(release_path, 'w')
- >>> release_file.write('This is a fake release file.')
+ >>> _ = release_file.write('This is a fake release file.')
>>> release_file.close()
>>> _ = archive_signing_key.signRepository(test_suite)
diff --git a/lib/lp/services/scripts/doc/script-monitoring.txt b/lib/lp/services/scripts/doc/script-monitoring.txt
index eeb3604..df81ad5 100644
--- a/lib/lp/services/scripts/doc/script-monitoring.txt
+++ b/lib/lp/services/scripts/doc/script-monitoring.txt
@@ -110,7 +110,7 @@ result of successful runs. This is intended for use by cron scripts
and others where it is useful to monitor the result.
>>> script_file = tempfile.NamedTemporaryFile()
- >>> script_file.write("""
+ >>> _ = script_file.write(b"""
... from lp.services.scripts.base import LaunchpadCronScript
...
... class TestScript(LaunchpadCronScript):
diff --git a/lib/lp/services/scripts/doc/scripts-and-zcml.txt b/lib/lp/services/scripts/doc/scripts-and-zcml.txt
index ab16030..76819f9 100644
--- a/lib/lp/services/scripts/doc/scripts-and-zcml.txt
+++ b/lib/lp/services/scripts/doc/scripts-and-zcml.txt
@@ -12,7 +12,7 @@ to demonstrate this:
>>> import tempfile
>>> from textwrap import dedent
>>> script_file = tempfile.NamedTemporaryFile()
- >>> script_file.write(dedent("""\
+ >>> _ = script_file.write(dedent("""\
... from __future__ import absolute_import, print_function
...
... from lp.services.scripts import execute_zcml_for_scripts
diff --git a/lib/lp/services/webservice/stories/xx-wadl.txt b/lib/lp/services/webservice/stories/xx-wadl.txt
index 70e1dcf..bc9711f 100644
--- a/lib/lp/services/webservice/stories/xx-wadl.txt
+++ b/lib/lp/services/webservice/stories/xx-wadl.txt
@@ -27,7 +27,7 @@ does not have any WADL files written to disk.
Let's write some fake WADL to disk.
>>> fd = open(wadl_filename, "w")
- >>> fd.write("Some fake WADL.")
+ >>> _ = fd.write("Some fake WADL.")
>>> fd.close()
When we request the WADL for version "devel", the fake WADL is loaded
diff --git a/lib/lp/translations/doc/sourcepackagerelease-translations.txt b/lib/lp/translations/doc/sourcepackagerelease-translations.txt
index 0a03aff..0ede73d 100644
--- a/lib/lp/translations/doc/sourcepackagerelease-translations.txt
+++ b/lib/lp/translations/doc/sourcepackagerelease-translations.txt
@@ -14,7 +14,7 @@ upload the same sampledata tarball twice, one public and one restricted
... 'doc/sourcepackagerelease-translations.tar.gz')
>>> tarball = open(tarball_path)
>>> tarball_size = len(tarball.read())
- >>> tarball.seek(0)
+ >>> _ = tarball.seek(0)
>>> from lp.services.librarian.interfaces import (
... ILibraryFileAliasSet)
@@ -24,7 +24,7 @@ upload the same sampledata tarball twice, one public and one restricted
... file=tarball,
... contentType='application/x-gtar')
- >>> tarball.seek(0)
+ >>> _ = tarball.seek(0)
>>> restricted_translation = getUtility(ILibraryFileAliasSet).create(
... name='test.tar.gz',
... size=tarball_size,