Skip to content

Commit 972b0a6

Browse files
authored
Merge pull request #407 from manu-chroma/master
sorting python imports using isort
2 parents cf54c35 + 09a5afe commit 972b0a6

28 files changed

+107
-85
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ MODULE=cwltool
2626
# `SHELL=bash` doesn't work for some, so don't use BASH-isms like
2727
# `[[` conditional expressions.
2828
PYSOURCES=$(wildcard ${MODULE}/**.py tests/*.py) setup.py
29-
DEVPKGS=pep8 diff_cover autopep8 pylint coverage pep257 flake8 pytest
29+
DEVPKGS=pep8 diff_cover autopep8 pylint coverage pep257 flake8 pytest isort
3030
DEBDEVPKGS=pep8 python-autopep8 pylint python-coverage pep257 sloccount python-flake8
3131
VERSION=1.0.$(shell date +%Y%m%d%H%M%S --date=`git log --first-parent \
3232
--max-count=1 --format=format:%cI`)
@@ -65,6 +65,11 @@ clean: FORCE
6565
rm -Rf .coverage
6666
rm -f diff-cover.html
6767

68+
# Linting and code style related targets
69+
## sorting imports using isort: https://github.com/timothycrosley/isort
70+
sort_imports:
71+
isort ${MODULE}/*.py tests/*.py setup.py
72+
6873
## pep8 : check Python code style
6974
pep8: $(PYSOURCES)
7075
pep8 --exclude=_version.py --show-source --show-pep8 $^ || true

cwltool/builder.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
import copy
2+
from typing import Any, Callable, Text, Type, Union
3+
4+
from six import iteritems, string_types
25

36
import avro
47
import schema_salad.validate as validate
58
from schema_salad.sourceline import SourceLine
6-
from typing import Any, Callable, Text, Type, Union
7-
from six import string_types, iteritems
89

910
from . import expression
1011
from .errors import WorkflowException
11-
from .pathmapper import PathMapper, normalizeFilesDirs, get_listing, visit_class
12+
from .mutation import MutationManager
13+
from .pathmapper import (PathMapper, get_listing, normalizeFilesDirs,
14+
visit_class)
1215
from .stdfsaccess import StdFsAccess
1316
from .utils import aslist
14-
from .mutation import MutationManager
1517

1618
CONTENT_LIMIT = 64 * 1024
1719

cwltool/cwlrdf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
from typing import IO, Any, Dict, Text
2+
13
from rdflib import Graph
4+
25
from schema_salad.jsonld_context import makerdf
36
from schema_salad.ref_resolver import ContextType
4-
from typing import Any, Dict, IO, Text
57
from six.moves import urllib
68

79
from .process import Process

cwltool/docker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
import subprocess
55
import sys
66
import tempfile
7+
from typing import Text
78

89
import requests
9-
from typing import Text
1010

1111
from .errors import WorkflowException
1212

cwltool/docker_uid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import print_function
2-
import subprocess
32

3+
import subprocess
44
from typing import Text
55

66

cwltool/draft2tool.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,33 @@
66
import re
77
import shutil
88
import tempfile
9-
from six.moves import urllib
10-
from six import string_types, u
119
from functools import partial
10+
from typing import Any, Callable, Dict, Generator, Optional, Text, Union, cast
11+
12+
from six import string_types, u
1213

1314
import schema_salad.validate as validate
1415
import shellescape
1516
from schema_salad.ref_resolver import file_uri, uri_file_path
1617
from schema_salad.sourceline import SourceLine, indent
17-
from typing import Any, Callable, cast, Generator, Optional, Text, Union, Dict
18+
from six.moves import urllib
1819

19-
from .builder import CONTENT_LIMIT, substitute, Builder
20-
from .pathmapper import adjustFileObjs, adjustDirObjs, visit_class
20+
from .builder import CONTENT_LIMIT, Builder, substitute
2121
from .errors import WorkflowException
22-
from .job import JobBase, CommandLineJob, DockerCommandLineJob
23-
from .pathmapper import PathMapper, get_listing, trim_listing
24-
from .process import (Process, shortname, uniquename, normalizeFilesDirs,
25-
compute_checksums, _logger_validation_warnings,
26-
UnsupportedRequirement)
22+
from .flatten import flatten
23+
from .job import CommandLineJob, DockerCommandLineJob, JobBase
24+
from .pathmapper import (PathMapper, adjustDirObjs, adjustFileObjs,
25+
get_listing, trim_listing, visit_class)
26+
from .process import (Process, UnsupportedRequirement,
27+
_logger_validation_warnings, compute_checksums,
28+
normalizeFilesDirs, shortname, uniquename)
2729
from .stdfsaccess import StdFsAccess
2830
from .utils import aslist
2931

3032
ACCEPTLIST_EN_STRICT_RE = re.compile(r"^[a-zA-Z0-9._+-]+$")
3133
ACCEPTLIST_EN_RELAXED_RE = re.compile(r".*") # Accept anything
3234
ACCEPTLIST_RE = ACCEPTLIST_EN_STRICT_RE
3335

34-
from .flatten import flatten
3536

3637
_logger = logging.getLogger("cwltool")
3738

cwltool/expression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import json
33
import logging
44
import re
5+
from typing import Any, AnyStr, Dict, List, Text, Union
56

6-
from typing import Any, AnyStr, Union, Text, Dict, List
77
from six import u
88

99
from . import sandboxjs

cwltool/factory.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import os
2-
3-
from typing import Any, Text, Union, Tuple
42
from typing import Callable as tCallable
3+
from typing import Any, Text, Tuple, Union
54

6-
from . import load_tool
7-
from . import main
8-
from . import workflow
5+
from . import load_tool, main, workflow
96
from .process import Process
107

118

cwltool/flatten.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from typing import Any, Callable, List, cast
22

3-
43
# http://rightfootin.blogspot.com/2006/09/more-on-python-flatten.html
54

65

cwltool/job.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@
88
import subprocess
99
import sys
1010
import tempfile
11+
from typing import (IO, Any, Callable, Iterable, List, MutableMapping, Text,
12+
Tuple, Union, cast)
1113

1214
import shellescape
13-
from typing import (Any, Callable, Union, Iterable, MutableMapping,
14-
IO, Text, Tuple, cast, List)
1515

1616
from . import docker
1717
from .builder import Builder
1818
from .docker_uid import docker_vm_uid
1919
from .errors import WorkflowException
2020
from .pathmapper import PathMapper
21-
from .process import (get_feature, empty_subtree, stageFiles,
22-
UnsupportedRequirement)
21+
from .process import (UnsupportedRequirement, empty_subtree, get_feature,
22+
stageFiles)
2323

2424
_logger = logging.getLogger("cwltool")
2525

0 commit comments

Comments
 (0)