launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #26344
[Merge] ~cjwatson/launchpad:py3-tarfile-files-to-bytes into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-tarfile-files-to-bytes into launchpad:master.
Commit message:
Rename LaunchpadWriteTarFile.files_to_string to files_to_bytes
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398261
This is clearer, especially for Python 3.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-tarfile-files-to-bytes into launchpad:master.
diff --git a/lib/lp/archivepublisher/tests/test_rosetta_translations.py b/lib/lp/archivepublisher/tests/test_rosetta_translations.py
index a2d7623..8812ef8 100644
--- a/lib/lp/archivepublisher/tests/test_rosetta_translations.py
+++ b/lib/lp/archivepublisher/tests/test_rosetta_translations.py
@@ -55,8 +55,7 @@ class TestRosettaTranslations(TestCaseWithFactory):
'source/po/foo.pot': b'Foo template',
'source/po/eo.po': b'Foo translation',
}
- tarfile_content = LaunchpadWriteTarFile.files_to_string(
- tar_content)
+ tarfile_content = LaunchpadWriteTarFile.files_to_bytes(tar_content)
return self.factory.makeLibraryFileAlias(content=tarfile_content,
filename=filename)
diff --git a/lib/lp/services/doc/tarfile_helpers.txt b/lib/lp/services/doc/tarfile_helpers.txt
index 034c8d4..9748d38 100644
--- a/lib/lp/services/doc/tarfile_helpers.txt
+++ b/lib/lp/services/doc/tarfile_helpers.txt
@@ -98,9 +98,9 @@ files_to_tarfile...
drei | vier
eins | zwei
-...or a data string.
+...or a byte string.
- >>> data = LaunchpadWriteTarFile.files_to_string(files)
+ >>> data = LaunchpadWriteTarFile.files_to_bytes(files)
>>> archive = tarfile.open('', 'r', io.BytesIO(data))
>>> examine_tarfile(archive)
drei | vier
diff --git a/lib/lp/services/tarfile_helpers.py b/lib/lp/services/tarfile_helpers.py
index abecc10..30f34d6 100644
--- a/lib/lp/services/tarfile_helpers.py
+++ b/lib/lp/services/tarfile_helpers.py
@@ -47,8 +47,8 @@ class LaunchpadWriteTarFile:
return buffer
@classmethod
- def files_to_string(cls, files):
- """Turn a dictionary of files into a data string."""
+ def files_to_bytes(cls, files):
+ """Turn a dictionary of files into a byte string."""
return cls.files_to_stream(files).read()
@classmethod
diff --git a/lib/lp/soyuz/tests/test_packagetranslationsuploadjob.py b/lib/lp/soyuz/tests/test_packagetranslationsuploadjob.py
index cef16f6..2775c89 100644
--- a/lib/lp/soyuz/tests/test_packagetranslationsuploadjob.py
+++ b/lib/lp/soyuz/tests/test_packagetranslationsuploadjob.py
@@ -72,8 +72,7 @@ class LocalTestHelper(TestCaseWithFactory):
'source/po/foo.pot': b'Foo template',
'source/po/eo.po': b'Foo translation',
}
- tarfile_content = LaunchpadWriteTarFile.files_to_string(
- tar_content)
+ tarfile_content = LaunchpadWriteTarFile.files_to_bytes(tar_content)
return self.factory.makeLibraryFileAlias(content=tarfile_content)
diff --git a/lib/lp/translations/doc/translationimportqueue.txt b/lib/lp/translations/doc/translationimportqueue.txt
index 2e853ea..dc64db9 100644
--- a/lib/lp/translations/doc/translationimportqueue.txt
+++ b/lib/lp/translations/doc/translationimportqueue.txt
@@ -973,7 +973,7 @@ We get a sample tarball to be uploaded into the system.
... 'es.po': b'Spanish translation',
... 'fr.po': b'French translation',
... }
- >>> tarfile_content = LaunchpadWriteTarFile.files_to_string(
+ >>> tarfile_content = LaunchpadWriteTarFile.files_to_bytes(
... test_tar_content)
>>> by_maintainer = True