Skip to content

Commit

Permalink
Bug 1611023: [taskgraph] Fix python3 flake8 errors in taskgraph; r=Ca…
Browse files Browse the repository at this point in the history
…llek

Differential Revision: https://phabricator.services.mozilla.com/D60782

--HG--
extra : moz-landing-system : lando
  • Loading branch information
tomprince committed Jan 23, 2020
1 parent f67d510 commit ecd3506
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 12 deletions.
1 change: 0 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ per-file-ignores =
mozglue/**: F821
python/mozbuild/**: F821
python/mozversioncontrol/**: F821
taskcluster/**: F821
testing/mozharness/**: F821
testing/talos/**: F821
toolkit/components/telemetry/**: F821
Expand Down
2 changes: 1 addition & 1 deletion taskcluster/taskgraph/actions/add_new_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def add_new_jobs_action(parameters, graph_config, input, task_group_id, task_id)
raise Exception('{} was not found in the task-graph'.format(elem))

times = input.get('times', 1)
for i in xrange(times):
for i in range(times):
create_tasks(
graph_config,
to_run,
Expand Down
2 changes: 1 addition & 1 deletion taskcluster/taskgraph/actions/add_talos.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def add_all_talos(parameters, graph_config, input, task_group_id, task_id):
parameters, graph_config)

times = input.get('times', 1)
for i in xrange(times):
for i in range(times):
to_run = [label
for label, entry
in full_task_graph.tasks.iteritems()
Expand Down
2 changes: 1 addition & 1 deletion taskcluster/taskgraph/actions/backfill.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def modifier(task):
return task

times = input.get('times', 1)
for i in xrange(times):
for i in range(times):
create_tasks(graph_config, [label], full_task_graph, label_to_taskid,
push_params, push_decision_task_id, push, modifier=modifier)
backfill_pushes.append(push)
Expand Down
2 changes: 2 additions & 0 deletions taskcluster/taskgraph/actions/isolate_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import os
import re

import six

from slugid import nice as slugid
from taskgraph.util.taskcluster import list_artifacts, get_artifact, get_task_definition
from ..util.parameterization import resolve_task_references
Expand Down
4 changes: 2 additions & 2 deletions taskcluster/taskgraph/actions/retrigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def retrigger_action(parameters, graph_config, input, task_group_id, task_id):
with_downstream = ' (with downstream) '

times = input.get('times', 1)
for i in xrange(times):
for i in range(times):
create_tasks(
graph_config,
to_run,
Expand Down Expand Up @@ -287,7 +287,7 @@ def retrigger_multiple(parameters, graph_config, input, task_group_id, task_id):
# those labels.
_rerun_task(label_to_taskid[label], label)

for j in xrange(times):
for j in range(times):
suffix = '{}-{}'.format(i, j)
suffixes.append(suffix)
create_tasks(
Expand Down
6 changes: 3 additions & 3 deletions taskcluster/taskgraph/actions/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
import logging
import os
import re
from functools import reduce

from six import text_type
from six import text_type, string_types

from requests.exceptions import HTTPError

Expand Down Expand Up @@ -252,8 +253,7 @@ def add_args_to_command(cmd_parts, extra_args=[]):
# windows has single cmd part as dict: 'task-reference', with long string
cmd_parts = cmd_parts[0]['task-reference'].split(' ')
cmd_type = 'dict'
elif len(cmd_parts) == 1 and (isinstance(cmd_parts[0], unicode) or
isinstance(cmd_parts[0], str)):
elif len(cmd_parts) == 1 and isinstance(cmd_parts[0], string_types):
# windows has single cmd part as a long string
cmd_parts = cmd_parts[0].split(' ')
cmd_type = 'unicode'
Expand Down
6 changes: 4 additions & 2 deletions taskcluster/taskgraph/cron/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

from __future__ import absolute_import, print_function, unicode_literals

from six import string_types


def match_utc(params, sched):
"""Return True if params['time'] matches the given schedule.
Expand All @@ -28,8 +30,8 @@ def match_utc(params, sched):
if sched.get('day') is not None and sched.get('day') != params['time'].day:
return False

if isinstance(sched.get('weekday'), str) or isinstance(sched.get('weekday'), unicode):
if sched.get('weekday', str()).lower() != params['time'].strftime('%A').lower():
if isinstance(sched.get('weekday'), string_types):
if sched['weekday'].lower() != params['time'].strftime('%A').lower():
return False
elif sched.get('weekday') is not None:
# don't accept other values.
Expand Down
2 changes: 1 addition & 1 deletion taskcluster/taskgraph/test/test_optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def test_replace_tasks_removed(self):
def assert_subgraph(self, graph, removed_tasks, replaced_tasks,
label_to_taskid, exp_subgraph, exp_label_to_taskid):
self.maxDiff = None
optimize.slugid = ('tid{}'.format(i) for i in xrange(1, 10)).next
optimize.slugid = ('tid{}'.format(i) for i in range(1, 10)).next
try:
got_subgraph = optimize.get_subgraph(graph, removed_tasks,
replaced_tasks, label_to_taskid)
Expand Down

0 comments on commit ecd3506

Please sign in to comment.