Skip to content

Commit 0514920

Browse files
authored
Merge pull request #51 from common-workflow-language/tighten-typecheck
tighten up types
2 parents ab9f395 + caa854a commit 0514920

File tree

7 files changed

+22
-22
lines changed

7 files changed

+22
-22
lines changed

.travis.yml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
1+
sudo: false
12
language: python
2-
python: 2.7
3+
python:
4+
- 2.7
5+
- 3.5
36
os:
47
- linux
5-
env:
6-
- TOX_ENV=py27-lint
7-
- TOX_ENV=py27-unit
8-
- TOX_ENV=py34-mypy
9-
# - TOX_ENV=py34-lint
10-
# - TOX_ENV=py33-lint
11-
# - TOX_ENV=py34-unit
12-
# - TOX_ENV=py33-unit
138

149
install:
15-
- pip install tox
16-
17-
script: tox -e $TOX_ENV
18-
10+
- pip install tox-travis
11+
script: tox
1912
notifications:
2013
email: false

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,9 @@ list-author-emails:
170170
@git log --format='%aN,%aE' | sort -u | grep -v 'root'
171171

172172
mypy: ${PYSOURCES}
173-
MYPYPATH=typeshed/2.7 mypy --py2 --disallow-untyped-calls schema_salad
173+
MYPYPATH=typeshed/2.7 mypy --py2 --disallow-untyped-calls \
174+
--fast-parser --warn-redundant-casts --warn-unused-ignores \
175+
schema_salad
174176

175177
jenkins:
176178
rm -Rf env && virtualenv env

schema_salad/flatten.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ def flatten(l, ltypes=(list, tuple)):
2121
else:
2222
l[i:i + 1] = l[i]
2323
i += 1
24-
return ltype(l) # type: ignore
24+
return ltype(l)

schema_salad/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def main(argsl=None): # type: (List[str]) -> int
188188
document, doc_metadata = document_loader.resolve_ref(uri)
189189
except (validate.ValidationException, RuntimeError) as e:
190190
_logger.error("Document `%s` failed validation:\n%s",
191-
args.document, e, exc_info=(e if args.debug else False))
191+
args.document, e, exc_info=args.debug)
192192
return 1
193193

194194
# Optionally print the document after ref resolution

schema_salad/ref_resolver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ def validate_links(self, document, base_url):
763763

764764
for key, val in iterator:
765765
try:
766-
document[key] = self.validate_links(val, docid) # type: ignore
766+
document[key] = self.validate_links(val, docid)
767767
except validate.ValidationException as v:
768768
if key not in self.nolinkcheck:
769769
docid2 = self.getid(val)

schema_salad/schema.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,7 @@ def make_valid_avro(items, alltypes, found, union=False):
351351
if items in alltypes and avro_name(items) not in found:
352352
return cast(Dict, make_valid_avro(alltypes[items], alltypes, found,
353353
union=union))
354-
items = avro_name(items) # type: ignore
355-
# bug in mypy 0.3.1, fixed in 0.4-dev
354+
items = avro_name(items)
356355
return items
357356

358357

tox.ini

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
[tox]
22
#envlist = py35-lint,py34-lint,py33-lint,py27-lint,py35-unit,py34-unit,py33-unit,py27-unit
3-
envlist = py27-lint, py27-unit, py34-mypy
3+
envlist = py27-lint, py27-unit, py35-mypy
44
skipsdist = True
55

6+
[tox:travis]
7+
2.7 = py27
8+
3.5 = py35-mypy
9+
610
[testenv]
711
deps = -rrequirements.txt
812

9-
[testenv:py34-mypy]
13+
[testenv:py35-mypy]
1014
commands = make mypy
1115
whitelist_externals = make
12-
deps = mypy-lang>=0.4
16+
deps =
17+
mypy-lang>=0.4
18+
typed-ast
1319

1420
[testenv:py35-lint]
1521
commands = flake8 schema_salad setup.py

0 commit comments

Comments
 (0)