Reland of PyLint fixes for tools-webrtc and webrtc/tools (patchset #1 id:1 of https://codereview.webrtc.org/2737233003/ )

Reason for revert:
Fixing errors for reland. I have tested that this does not make Chromium video quality tests fail.

Original issue's description:
> Revert of PyLint fixes for tools-webrtc and webrtc/tools (patchset #3 id:40001 of https://codereview.webrtc.org/2736233003/ )
>
> Reason for revert:
> Fails video quality tests in Chrome:  http://build.chromium.org/p/chromium.webrtc.fyi/builders/Win10%20Tester/builds/6568
> I should have looked more closer at those :(
>
> Original issue's description:
> > PyLint fixes for tools-webrtc and webrtc/tools
> >
> > Fix a lot of errors before bringing in the new config in
> > https://codereview.webrtc.org/2737963003/
> >
> > BUG=webrtc:7303
> > NOTRY=True
> >
> > Review-Url: https://codereview.webrtc.org/2736233003
> > Cr-Commit-Position: refs/heads/master@{#17137}
> > Committed: f5318e1f39
>
> TBR=oprypin@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7303
>
> Review-Url: https://codereview.webrtc.org/2737233003
> Cr-Commit-Position: refs/heads/master@{#17142}
> Committed: 94f4d9effc

NOTRY=true
BUG=webrtc:7312

Review-Url: https://codereview.webrtc.org/2741733003
Cr-Commit-Position: refs/heads/master@{#17541}
This commit is contained in:
kjellander
2017-04-05 06:42:43 -07:00
committed by Commit bot
parent adf0635ed5
commit c88b5d56ad
15 changed files with 154 additions and 157 deletions

View File

@ -12,7 +12,7 @@ import os
import sys
def _crop_one_frame(yuv_file, output_file, component_sizes):
def _CropOneFrame(yuv_file, output_file, component_sizes):
"""Crops one frame.
This function crops one frame going through all the YUV planes and cropping
@ -44,7 +44,7 @@ def _crop_one_frame(yuv_file, output_file, component_sizes):
return True
def crop_frames(yuv_file_name, output_file_name, width, height, crop_height):
def CropFrames(yuv_file_name, output_file_name, width, height, crop_height):
"""Crops rows of pixels from the top of the YUV frames.
This function goes through all the frames in a video and crops the crop_height
@ -69,13 +69,13 @@ def crop_frames(yuv_file_name, output_file_name, width, height, crop_height):
data_left = True
while data_left:
data_left = _crop_one_frame(yuv_file, output_file, component_sizes)
data_left = _CropOneFrame(yuv_file, output_file, component_sizes)
yuv_file.close()
output_file.close()
def _parse_args():
def _ParseArgs():
"""Registers the command-line options."""
usage = "usage: %prog [options]"
parser = optparse.OptionParser(usage=usage)
@ -101,7 +101,7 @@ def _parse_args():
return options
def _main():
def main():
"""A tool to crop rows of pixels from the top part of a YUV file.
A simple invocation will be:
@ -109,17 +109,17 @@ def _main():
--yuv_file=<path_and_name_of_yuv_file>
--output_yuv=<path and name_of_output_file>
"""
options = _parse_args()
options = _ParseArgs()
if os.path.getsize(options.yuv_file) == 0:
sys.stderr.write('Error: The YUV file you have passed has size 0. The '
'produced output will also have size 0.\n')
return -1
crop_frames(options.yuv_file, options.output_file, options.width,
options.height, options.crop_height)
CropFrames(options.yuv_file, options.output_file, options.width,
options.height, options.crop_height)
return 0
if __name__ == '__main__':
sys.exit(_main())
sys.exit(main())