Fixing py lint errors

Bug: webrtc:9548
Change-Id: I0daf8dc06fdaac1637c32994ef6ad542ed52202a
Reviewed-on: https://webrtc-review.googlesource.com/90045
Reviewed-by: Oleh Prypin <oprypin@webrtc.org>
Reviewed-by: Niklas Enbom <niklas.enbom@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24068}
This commit is contained in:
Artem Titov 2018-07-23 13:58:25 +02:00 committed by Commit Bot
parent 2a959d96c9
commit 5d7a4c6692
9 changed files with 17 additions and 16 deletions

View file

@ -66,9 +66,9 @@ def ParseAnaDump(dump_file_to_parse):
first_time_stamp = None
while True:
event = GetNextMessageFromFile(file_to_parse)
if event == None:
if event is None:
break
if first_time_stamp == None:
if first_time_stamp is None:
first_time_stamp = event.timestamp
if event.type == debug_dump_pb2.Event.ENCODER_RUNTIME_CONFIG:
for decision in event.encoder_runtime_config.DESCRIPTOR.fields:
@ -110,7 +110,7 @@ def main():
action='append')
options = parser.parse_args()[0]
if options.dump_file_to_parse == None:
if options.dump_file_to_parse is None:
print "No dump file to parse is set.\n"
parser.print_help()
exit()

View file

@ -61,7 +61,7 @@ class InputSignalCreator(object):
AudioSegment instance.
"""
assert 0 < frequency <= 24000
assert 0 < duration
assert duration > 0
template = signal_processing.SignalProcessingUtils.GenerateSilence(duration)
return signal_processing.SignalProcessingUtils.GeneratePureTone(
template, frequency)

View file

@ -41,7 +41,7 @@ def ParsePlotLine(line):
# The variable name can contain any non-whitespace character except "#:@"
match = re.match(r'([^\s#:@]+)(?:#\d)?:(\d+)@(\S+)', annotated_var)
if match == None:
if match is None:
raise ParsePlotLineException("Could not parse variable name, ssrc and \
algorithm name", annotated_var)
var_name = match.group(1)

View file

@ -237,7 +237,7 @@ class CheckNoMixingSourcesTest(unittest.TestCase):
self.assertTrue('bar.c' in str(errors[0]))
def _AssertNumberOfErrorsWithSources(self, number_of_errors, sources):
assert 3 == len(sources), 'This function accepts a list of 3 source files'
assert len(sources) == 3, 'This function accepts a list of 3 source files'
self._GenerateBuildFile(textwrap.dedent("""
rtc_static_library("bar_foo") {
sources = [

View file

@ -20,6 +20,7 @@ disable=
I0010,
I0011,
W0232,
C0413,
bad-continuation,
broad-except,
duplicate-code,

View file

@ -161,9 +161,9 @@ def Build(build_dir, arch, use_goma, extra_gn_args, extra_gn_switches,
gn_args_str = '--args=' + ' '.join([
k + '=' + _EncodeForGN(v) for k, v in gn_args.items()] + extra_gn_args)
gn_args = ['gen', output_directory, gn_args_str]
gn_args.extend(extra_gn_switches)
_RunGN(gn_args)
gn_args_list = ['gen', output_directory, gn_args_str]
gn_args_list.extend(extra_gn_switches)
_RunGN(gn_args_list)
ninja_args = TARGETS[:]
if use_goma:

View file

@ -61,7 +61,7 @@ def main():
snapshots = []
while True:
snapshot = GrabCpuSamples(sample_count)
if snapshot == None:
if snapshot is None:
break
snapshots.append(snapshot)

View file

@ -16,8 +16,8 @@ SRC = os.path.abspath(os.path.join(
os.path.dirname((__file__)), os.pardir, os.pardir))
sys.path.append(os.path.join(SRC, 'third_party', 'pymock'))
import mock
import unittest
import mock
from generate_licenses import LicenseBuilder

View file

@ -196,9 +196,9 @@ def AverageOverCycle(values, length):
total = [0.0] * length
count = [0] * length
for k in range(len(values)):
if values[k] is not None:
total[k % length] += values[k]
for k, val in enumerate(values):
if val is not None:
total[k % length] += val
count[k % length] += 1
result = [0.0] * length
@ -386,11 +386,11 @@ def PlotConfigsFromArgs(args):
# argparse.ArgumentParser, modified to remember the order of arguments.
# Then we traverse the argument list and fill the PlotConfig.
args = itertools.groupby(args, lambda x: x in ["-n", "--next"])
args = list(list(group) for match, group in args if not match)
prep_args = list(list(group) for match, group in args if not match)
parser = GetParser()
plot_configs = []
for index, raw_args in enumerate(args):
for index, raw_args in enumerate(prep_args):
graph_args = parser.parse_args(raw_args).ordered_args
plot_configs.append(_PlotConfigFromArgs(graph_args, index))
return plot_configs