Skip to content

Commit 4fd2308

Browse files
authored
Fix flake8 setup (#1288)
1 parent e9c8373 commit 4fd2308

30 files changed

+62
-65
lines changed

cwltool/builder.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import copy
22
import logging
3-
import os
43
import math
4+
import os
55
from typing import (
66
IO,
77
Any,
@@ -18,14 +18,13 @@
1818

1919
from rdflib import Graph, URIRef
2020
from rdflib.namespace import OWL, RDFS
21-
from typing_extensions import TYPE_CHECKING, Type # pylint: disable=unused-import
22-
2321
from ruamel.yaml.comments import CommentedMap
2422
from schema_salad import validate
2523
from schema_salad.avro.schema import Schema, make_avsc_object
2624
from schema_salad.schema import Names, convert_to_dict
2725
from schema_salad.sourceline import SourceLine
2826
from schema_salad.utils import json_dumps
27+
from typing_extensions import TYPE_CHECKING, Type # pylint: disable=unused-import
2928

3029
from . import expression
3130
from .errors import WorkflowException

cwltool/command_line_tool.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,12 @@
2929
)
3030

3131
import shellescape
32-
from typing_extensions import TYPE_CHECKING, Type
33-
3432
from schema_salad import validate
3533
from schema_salad.avro.schema import Schema
3634
from schema_salad.ref_resolver import file_uri, uri_file_path
3735
from schema_salad.sourceline import SourceLine
3836
from schema_salad.utils import json_dumps
37+
from typing_extensions import TYPE_CHECKING, Type
3938

4039
from .builder import Builder, content_limit_respected_read_bytes, substitute
4140
from .context import LoadingContext, RuntimeContext, getdefault
@@ -633,8 +632,8 @@ def update_status_output_callback(
633632
t["entry"]["writable"] = t.get("writable")
634633
ls[i] = t["entry"]
635634
j.generatefiles["listing"] = ls
636-
for l in ls:
637-
self.updatePathmap(builder.outdir, builder.pathmapper, l)
635+
for entry in ls:
636+
self.updatePathmap(builder.outdir, builder.pathmapper, entry)
638637
visit_class(
639638
[builder.files, builder.bindings], ("File", "Directory"), _check_adjust
640639
)

cwltool/context.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
import threading
44
from typing import Any, Callable, Dict, Iterable, List, MutableMapping, Optional
55

6-
from typing_extensions import TYPE_CHECKING
7-
86
# move to a regular typing import when Python 3.3-3.6 is no longer supported
97
from ruamel.yaml.comments import CommentedMap
108
from schema_salad import schema
119
from schema_salad.ref_resolver import Loader
10+
from typing_extensions import TYPE_CHECKING
1211

1312
from .builder import Builder, HasReqsHints
1413
from .mutation import MutationManager

cwltool/cwlrdf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from typing import IO, Any, Dict, MutableMapping, cast
33

44
from rdflib import Graph
5-
65
from schema_salad.jsonld_context import makerdf
76
from schema_salad.ref_resolver import ContextType
87

cwltool/docker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
"""Enables Docker software containers via the {dx-,u,}docker runtimes."""
22

3-
import datetime
43
import csv
4+
import datetime
55
import os
66
import re
77
import shutil
88
import sys
99
import tempfile
1010
import threading
1111
from distutils import spawn
12-
from io import open, StringIO # pylint: disable=redefined-builtin
12+
from io import StringIO, open # pylint: disable=redefined-builtin
1313
from typing import Dict, List, MutableMapping, Optional, Set, Tuple
1414

1515
import requests

cwltool/executors.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,16 @@
1212
Dict,
1313
Iterable,
1414
List,
15+
MutableMapping,
1516
Optional,
1617
Set,
1718
Tuple,
1819
Union,
19-
MutableMapping,
2020
)
2121

2222
import psutil
23-
24-
from schema_salad.validate import ValidationException
2523
from schema_salad.sourceline import SourceLine
24+
from schema_salad.validate import ValidationException
2625

2726
from .command_line_tool import CallbackJob
2827
from .context import RuntimeContext, getdefault

cwltool/flatten.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33
# http://rightfootin.blogspot.com/2006/09/more-on-python-flatten.html
44

55

6-
def flatten(l, ltypes=(list, tuple)):
6+
def flatten(thing, ltypes=(list, tuple)):
77
# type: (Any, Any) -> List[Any]
8-
if l is None:
8+
if thing is None:
99
return []
10-
if not isinstance(l, ltypes):
11-
return [l]
10+
if not isinstance(thing, ltypes):
11+
return [thing]
1212

13-
ltype = type(l)
14-
l = list(l)
13+
ltype = type(thing)
14+
thing_list = list(thing)
1515
i = 0
16-
while i < len(l):
17-
while isinstance(l[i], ltypes):
18-
if not l[i]:
19-
l.pop(i)
16+
while i < len(thing_list):
17+
while isinstance(thing_list[i], ltypes):
18+
if not thing_list[i]:
19+
thing_list.pop(i)
2020
i -= 1
2121
break
2222
else:
23-
l[i : i + 1] = l[i]
23+
thing_list[i : i + 1] = thing_list[i]
2424
i += 1
25-
return cast(Callable[[Any], List[Any]], ltype)(l)
25+
return cast(Callable[[Any], List[Any]], ltype)(thing_list)

cwltool/job.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@
3434
import psutil
3535
import shellescape
3636
from prov.model import PROV
37-
from typing_extensions import TYPE_CHECKING
38-
3937
from schema_salad.sourceline import SourceLine
4038
from schema_salad.utils import json_dump, json_dumps
39+
from typing_extensions import TYPE_CHECKING
4140

4241
from .builder import Builder, HasReqsHints
4342
from .context import RuntimeContext, getdefault

cwltool/load_tool.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
)
2121

2222
import requests.sessions
23-
2423
from ruamel.yaml.comments import CommentedMap, CommentedSeq
2524
from schema_salad import schema
2625
from schema_salad.ref_resolver import ContextType, Fetcher, Loader, SubLoader, file_uri

cwltool/main.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333
import coloredlogs
3434
import pkg_resources # part of setuptools
35-
3635
from ruamel import yaml
3736
from ruamel.yaml.comments import CommentedMap, CommentedSeq
3837
from schema_salad import validate

0 commit comments

Comments
 (0)