Skip to content

Commit 165899f

Browse files
authored
Merge pull request #2 from common-workflow-language/type-safety
add PEP484 typeshed
2 parents 7f9a6a3 + b0bc760 commit 165899f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+3511
-5
lines changed

.travis.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
sudo: false
2+
language: python
3+
python:
4+
- 2.7
5+
- 3.5
6+
os:
7+
- linux
8+
9+
install:
10+
- pip install tox-travis
11+
script: tox
12+
notifications:
13+
email: false

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ help: Makefile
4343
## install-dep : install most of the development dependencies via pip
4444
install-dep:
4545
pip install --upgrade $(DEVPKGS)
46+
pip install -r requirements.txt
4647

4748
## install-deb-dep: install most of the dev dependencies via apt-get
4849
install-deb-dep:

cwltest/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import pipes
1313
import logging
1414
import schema_salad.ref_resolver
15-
from typing import Any, Dict
15+
from typing import Any, Dict, List, Text
1616

1717
_logger = logging.getLogger("cwltest")
1818
_logger.addHandler(logging.StreamHandler())
@@ -180,7 +180,7 @@ def main(): # type: () -> int
180180
failures = 0
181181
unsupported = 0
182182
passed = 0
183-
xml_lines = []
183+
xml_lines = [] # type: List[Text]
184184

185185
if args.only_tools:
186186
alltests = tests
@@ -249,11 +249,12 @@ def main(): # type: () -> int
249249

250250

251251
def make_xml_lines(test, rt, test_case_group='N/A'):
252+
# type: (Dict[Text, Any], int, Text) -> List[Text]
252253
doc = test.get('doc', 'N/A').strip()
253254
test_case_group = test_case_group.replace(".yaml", "").replace(".yml", "")
254255
elem = ' <testcase name="%s" classname="%s"' % (doc, test_case_group.replace(".", "_"))
255256
if rt == 0:
256-
return elem + '/>\n'
257+
return [ elem + '/>\n' ]
257258
if rt == UNSUPPORTED_FEATURE:
258259
return [
259260
elem + '>\n',

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
schema-salad >= 1.14
2+
typing >= 3.5.2

setup.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[flake8]
2+
ignore = E124,E128,E129,E201,E202,E225,E226,E231,E265,E271,E302,E303,F401,E402,E501,W503,E731,F811,F821,F841
3+
4+
[easy_install]
5+

setup.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#!/usr/bin/env python
22

33
import os
4-
import sys
5-
import shutil
64

75
import setuptools.command.egg_info as egg_info_cmd
86
from setuptools import setup, find_packages

tox.ini

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
[tox]
2+
#envlist = py35-lint,py34-lint,py33-lint,py27-lint,py35-unit,py34-unit,py33-unit,py27-unit
3+
envlist = py27-lint, py27-unit, py35-mypy
4+
skipsdist = True
5+
6+
[tox:travis]
7+
2.7 = py27
8+
3.5 = py35-mypy
9+
10+
[testenv]
11+
deps = -rrequirements.txt
12+
13+
[testenv:py35-mypy]
14+
commands = make mypy
15+
whitelist_externals = make
16+
deps =
17+
mypy-lang>=0.4
18+
typed-ast
19+
-rrequirements.txt
20+
21+
[testenv:py35-lint]
22+
commands = flake8 cwltest setup.py
23+
whitelist_externals = flake8
24+
deps = flake8
25+
26+
[testenv:py34-lint]
27+
commands = flake8 cwltest setup.py
28+
whitelist_externals = flake8
29+
deps = flake8
30+
31+
[testenv:py33-lint]
32+
commands = flake8 cwltest setup.py
33+
whitelist_externals = flake8
34+
deps = flake8
35+
36+
[testenv:py27-lint]
37+
commands = flake8 cwltest setup.py
38+
whitelist_externals = flake8
39+
deps = flake8
40+
41+
[testenv:py35-unit]
42+
commands = python setup.py test
43+
44+
[testenv:py34-unit]
45+
commands = python setup.py test
46+
47+
[testenv:py33-unit]
48+
commands = python setup.py test
49+
50+
[testenv:py27-unit]
51+
commands = python setup.py test

typeshed/2.7/StringIO.pyi

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Stubs for StringIO (Python 2)
2+
3+
from typing import (Any, IO, AnyStr, Iterator, Iterable, Generic, List, Text,
4+
Union)
5+
6+
class StringIO(IO[AnyStr], Generic[AnyStr]):
7+
closed = ... # type: bool
8+
softspace = ... # type: int
9+
len = ... # type: int
10+
def __init__(self, buf: AnyStr = ...) -> None: ...
11+
def __iter__(self) -> Iterator[AnyStr]: ...
12+
def next(self) -> AnyStr: ...
13+
def close(self) -> None: ...
14+
def isatty(self) -> bool: ...
15+
def seek(self, pos: int, mode: int = ...) -> None: ...
16+
def tell(self) -> int: ...
17+
def read(self, n: int = ...) -> AnyStr: ...
18+
def readline(self, length: int = ...) -> AnyStr: ...
19+
def readlines(self, sizehint: int = ...) -> List[AnyStr]: ...
20+
def truncate(self, size: int = ...) -> int: ...
21+
def write(self, s: Union[str, Text]) -> None: ...
22+
def writelines(self, iterable: Iterable[Union[str, Text]]) -> None: ...
23+
def flush(self) -> None: ...
24+
def getvalue(self) -> AnyStr: ...
25+
def __enter__(self) -> Any: ...
26+
def __exit__(self, type: Any, value: Any, traceback: Any) -> Any: ...
27+
def fileno(self) -> int: ...
28+
def readable(self) -> bool: ...
29+
def seekable(self) -> bool: ...
30+
def writable(self) -> bool: ...

0 commit comments

Comments
 (0)