|
|
DescriptionMake json5_generator.Writer always take a list of files.
The json5_generator.Writer constructor has a convenient interface where
you can specify either the name of a single file you want to read from,
or a list of files. However, this requires a branch in Writer that
checks if the argument is a string or a list, which is not Pythonic.
This patch makes Writer always take a list of files.
BUG=628043
Review-Url: https://codereview.chromium.org/2815773003
Cr-Commit-Position: refs/heads/master@{#466175}
Committed: https://chromium.googlesource.com/chromium/src/+/3c3d810d9753f4c0138a84e0a4965880866304ed
Patch Set 1 #
Total comments: 2
Patch Set 2 : Fix #Patch Set 3 : Rebase #Patch Set 4 : Rebase #
Depends on Patchset: Dependent Patchsets: Messages
Total messages: 33 (25 generated)
shend@chromium.org changed reviewers: + bugsnash@chromium.org
Hi Bugs, PTAL
The CQ bit was checked by shend@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
lgtm
shend@chromium.org changed reviewers: + alancutter@chromium.org
Hi Alan, PTAL
https://codereview.chromium.org/2815773003/diff/1/third_party/WebKit/Source/b... File third_party/WebKit/Source/build/scripts/json5_generator.py (left): https://codereview.chromium.org/2815773003/diff/1/third_party/WebKit/Source/b... third_party/WebKit/Source/build/scripts/json5_generator.py:200: json5_files = [json5_files] This code (that existed) smells bad. Are we certain that this needs to be a branch point and the condition is not the same at every call site? Can you give examples where it differs? I'm not comfortable having it moved to a place with a name like load_from_files() without properly understanding its reason for existing.
Description was changed from ========== Make json5_generator.JSON5File.load_from_files easier to use. json5_generator.Writer constructor has a convenient interface where you can either specify the name of a single file you want to read from, or a list of files. However, if we're reading from multiple files, we are forced to use JSON5File.load_from_files instead, which does not have this convenience. This patch moves the convenience logic to load_from_files so that both JSON5File and Writer can share it. This patch also makes the default_metadata parameter in load_from_files optional. BUG=628043 ========== to ========== Make json5_generator.Writer always take a list of files. The json5_generator.Writer constructor has a convenient interface where you can specify either the name of a single file you want to read from, or a list of files. However, this requires a branch in Writer that checks if the argument is a string or a list, which is not Pythonic. This patch makes Writer always take a list of files. BUG=628043 ==========
Fixed, PTAL https://codereview.chromium.org/2815773003/diff/1/third_party/WebKit/Source/b... File third_party/WebKit/Source/build/scripts/json5_generator.py (left): https://codereview.chromium.org/2815773003/diff/1/third_party/WebKit/Source/b... third_party/WebKit/Source/build/scripts/json5_generator.py:200: json5_files = [json5_files] On 2017/04/13 at 03:23:52, alancutter wrote: > This code (that existed) smells bad. Are we certain that this needs to be a branch point and the condition is not the same at every call site? Can you give examples where it differs? > > I'm not comfortable having it moved to a place with a name like load_from_files() without properly understanding its reason for existing. Done.
lgtm
The CQ bit was checked by shend@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_ozone_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
The CQ bit was checked by shend@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by shend@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by shend@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by shend@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from bugsnash@chromium.org, alancutter@chromium.org Link to the patchset: https://codereview.chromium.org/2815773003/#ps60001 (title: "Rebase")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch. Bot data: {"patchset_id": 60001, "attempt_start_ts": 1492728618278190, "parent_rev": "5e246838263416bcd05bf1b10c6c4d8582681a5a", "commit_rev": "3c3d810d9753f4c0138a84e0a4965880866304ed"}
Message was sent while issue was closed.
Description was changed from ========== Make json5_generator.Writer always take a list of files. The json5_generator.Writer constructor has a convenient interface where you can specify either the name of a single file you want to read from, or a list of files. However, this requires a branch in Writer that checks if the argument is a string or a list, which is not Pythonic. This patch makes Writer always take a list of files. BUG=628043 ========== to ========== Make json5_generator.Writer always take a list of files. The json5_generator.Writer constructor has a convenient interface where you can specify either the name of a single file you want to read from, or a list of files. However, this requires a branch in Writer that checks if the argument is a string or a list, which is not Pythonic. This patch makes Writer always take a list of files. BUG=628043 Review-Url: https://codereview.chromium.org/2815773003 Cr-Commit-Position: refs/heads/master@{#466175} Committed: https://chromium.googlesource.com/chromium/src/+/3c3d810d9753f4c0138a84e0a496... ==========
Message was sent while issue was closed.
Committed patchset #4 (id:60001) as https://chromium.googlesource.com/chromium/src/+/3c3d810d9753f4c0138a84e0a496... |