Skip to content

Commit 6266928

Browse files
author
Peter Amstutz
committed
Squashed 'draft-4/salad/' changes from 9c8c36f..c509a07
c509a07 Merge pull request #34 from common-workflow-language/unscoped_ids f857e9d type fixups 0407370 Allow idmaps for record fields. 5d9a08e Use makerdf for --print-rdf ce00252 Add test for non-scoped identifiers. ef27301 restore a dropped cast 6ac559e version bump 2cfde6b Merge pull request #32 from common-workflow-language/type_dsl b8edddc re-enable test_avro_regression bedb736 Merge branch 'type_dsl' of github.com:common-workflow-language/schema_salad into type_dsl e93b038 Add missing file 9ca6cc9 remove more str types, possible fix for edam failed test d65fb83 more unicode 4350b30 type clarification 96f08e8 Merge remote-tracking branch 'origin/master' into type_dsl 57f7e83 borrow the updated re.pyi from typeshed c03eb1e type fixes 6e71f35 Merge remote-tracking branch 'origin/master' into type_dsl e554b2b Merge pull request #33 from common-workflow-language/fix-resolve_all_refactor ad34521 fix bug introduced by refactor 5393edc fixes types, removes a few more Anys e298bdc Detect when an abstract class is used but doesn't have a concrete subtype. 851b3c1 Split minimal base types used in CWL into metaschema_base.yml 8823aaa Adjust ref scopes 3431e18 Use scopedRef and typeDSL in metaschema 1e6dab6 Using typeDSL in metaschema. 3055f70 Update bootstrap context. 31db28e Merge branch 'master' into type_dsl. Add test for typeDSL. 116d9e4 Merge branch 'resolve_all_refactor' 8072bf5 "type" DSL wip 33ef215 Refactor resolve_all into smaller methods. ad8a111 Merge pull request #28 from common-workflow-language/scoped_ref 5aadf27 fix types 4ef52be Improve documentation. Add feature of skipping some inner scopes. c6d4a7b Reworking refScope to be fixed instead of search based. ae0ef4e Remove explicit calls to validate_links since it is folded into resolve_all(). 2fa6bfb update types e5d4730 New test for scoped ref that better reflects actual desired behavior. efbc9c4 Add scopedRef to metaschema. Tweak test. 9fcd67d Fold link validation into resolve_all() and resolve scoped identifiers. da10eec always be updating (mypy-lang) e1e17ea upgrade Jenkins setuptools 563e5ef fix jenkins build f0ac285 Merge branch 'master' of github.com:common-workflow-language/schema_salad 84738f1 better RDF schema error handling (#26) 3b8dc09 mypy 0.4 is out (#25) 8c5bda0 Fix mapSubject fields when $import or $include is provided. 5b969ca fix diff-cover d798a7e split out mypy f43fa45 Fix tests 2d0398e Bump version. aeab7c3 Merge branch 'master' of github.com:common-workflow-language/schema_salad e381f64 Return metaschema loader from load_schema. Don't crash expanding identifier fields when value is not a string. 15dae9f enhance CI fd2fcb3 more type checking (#21) c51c723 enable rdfa schema format (#22) ff192e8 turn off py3 support for now (#19) 0c5dba5 measure code coverage (#12) 2514a23 switch to ruamel.yaml, use C loader if available, only load safely (#20) 37c129d Merge branch 'master' of github.com:common-workflow-language/schema_salad 0b09a19 Makedoc detects any ``` for toggling looking for # for section headings. d361b6c Bump version # 2da084e Add mapSubject and mapPredicate to metaschema. 2b00752 Turn idMap into mapSubject and mapPredicate. af7a419 Support id maps in preprocessing. 984ab9c Fix makedoc section header bug. cc0f52b Add margin to <pre> sections in generated documentation. git-subtree-dir: draft-4/salad git-subtree-split: c509a07
1 parent 9c8c36f commit 6266928

Some content is hidden

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

86 files changed

+4293
-706
lines changed

.travis.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ python: 2.7
33
os:
44
- linux
55
env:
6-
- TOX_ENV=py34-lint
7-
- TOX_ENV=py33-lint
86
- TOX_ENV=py27-lint
9-
- TOX_ENV=py26-lint
10-
- TOX_ENV=py34-unit
11-
- TOX_ENV=py33-unit
127
- TOX_ENV=py27-unit
13-
- TOX_ENV=py26-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
1413

1514
install:
1615
- pip install tox

Makefile

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
# This file is part of schema-salad,
2+
# https://github.com/common-workflow-language/schema-salad/, and is
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
18+
# make pep8 to check for basic Python code compliance
19+
# make autopep8 to fix most pep8 errors
20+
# make pylint to check Python code for enhanced compliance including naming
21+
# and documentation
22+
# make coverage-report to check coverage of the python scripts by the tests
23+
24+
MODULE=schema_salad
25+
26+
# `SHELL=bash` Will break Titus's laptop, so don't use BASH-isms like
27+
# `[[` conditional expressions.
28+
PYSOURCES=$(wildcard ${MODULE}/**.py tests/*.py) setup.py
29+
DEVPKGS=pep8 diff_cover autopep8 pylint coverage pep257
30+
31+
VERSION=$(shell git describe --tags --dirty | sed s/v//)
32+
33+
## all : default task
34+
all: ./setup.py develop
35+
36+
## help : print this help message and exit
37+
help: Makefile
38+
@sed -n 's/^##//p' $<
39+
40+
## install-dep : install most of the development dependencies via pip
41+
install-dep: install-dependencies
42+
43+
install-dependencies:
44+
pip install --upgrade $(DEVPKGS)
45+
pip install -r requirements.txt
46+
47+
## install : install the ${MODULE} module and schema-salad-tool
48+
install: FORCE
49+
./setup.py build install
50+
51+
## dist : create a module package for distribution
52+
dist: dist/${MODULE}-$(VERSION).tar.gz
53+
54+
dist/${MODULE}-$(VERSION).tar.gz: $(SOURCES)
55+
./setup.py sdist
56+
57+
## clean : clean up all temporary / machine-generated files
58+
clean: FORCE
59+
rm -f ${MODILE}/*.pyc tests/*.pyc
60+
./setup.py clean --all || true
61+
rm -Rf .coverage
62+
rm -f diff-cover.html
63+
64+
## pep8 : check Python code style
65+
pep8: $(PYSOURCES)
66+
pep8 --exclude=_version.py --show-source --show-pep8 $^ || true
67+
68+
pep8_report.txt: $(PYSOURCES)
69+
pep8 --exclude=_version.py $^ > $@ || true
70+
71+
diff_pep8_report: pep8_report.txt
72+
diff-quality --violations=pep8 pep8_report.txt
73+
74+
## pep257 : check Python code style
75+
pep257: $(PYSOURCES)
76+
pep257 --ignore=D100,D101,D102,D103 $^ || true
77+
78+
pep257_report.txt: $(PYSOURCES)
79+
pep257 setup.py $^ > $@ 2>&1 || true
80+
81+
diff_pep257_report: pep257_report.txt
82+
diff-quality --violations=pep8 pep257_report.txt
83+
84+
## autopep8 : fix most Python code indentation and formatting
85+
autopep8: $(PYSOURCES)
86+
autopep8 --recursive --in-place --ignore E309 $^
87+
88+
# A command to automatically run astyle and autopep8 on appropriate files
89+
## format : check/fix all code indentation and formatting (runs autopep8)
90+
format: autopep8
91+
# Do nothing
92+
93+
## pylint : run static code analysis on Python code
94+
pylint: $(PYSOURCES)
95+
pylint --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \
96+
$^ || true
97+
98+
pylint_report.txt: ${PYSOURCES}
99+
pylint --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \
100+
$^ > $@ || true
101+
102+
diff_pylint_report: pylint_report.txt
103+
diff-quality --violations=pylint pylint_report.txt
104+
105+
.coverage: $(PYSOURCES)
106+
coverage run --branch --source=${MODULE} setup.py test
107+
coverage run --append --branch --source=${MODULE} \
108+
-m schema_salad.main \
109+
--print-jsonld-context schema_salad/metaschema/metaschema.yml \
110+
> /dev/null
111+
coverage run --append --branch --source=${MODULE} \
112+
-m schema_salad.main \
113+
--print-rdfs schema_salad/metaschema/metaschema.yml \
114+
> /dev/null
115+
coverage run --append --branch --source=${MODULE} \
116+
-m schema_salad.main \
117+
--print-avro schema_salad/metaschema/metaschema.yml \
118+
> /dev/null
119+
coverage run --append --branch --source=${MODULE} \
120+
-m schema_salad.main \
121+
--print-rdf schema_salad/metaschema/metaschema.yml \
122+
> /dev/null
123+
coverage run --append --branch --source=${MODULE} \
124+
-m schema_salad.main \
125+
--print-pre schema_salad/metaschema/metaschema.yml \
126+
> /dev/null
127+
coverage run --append --branch --source=${MODULE} \
128+
-m schema_salad.main \
129+
--print-index schema_salad/metaschema/metaschema.yml \
130+
> /dev/null
131+
coverage run --append --branch --source=${MODULE} \
132+
-m schema_salad.main \
133+
--print-metadata schema_salad/metaschema/metaschema.yml \
134+
> /dev/null
135+
coverage run --append --branch --source=${MODULE} \
136+
-m schema_salad.makedoc schema_salad/metaschema/metaschema.yml \
137+
> /dev/null
138+
139+
coverage.xml: .coverage
140+
coverage xml
141+
142+
coverage.html: htmlcov/index.html
143+
144+
htmlcov/index.html: .coverage
145+
coverage html
146+
@echo Test coverage of the Python code is now in htmlcov/index.html
147+
148+
coverage-report: .coverage
149+
coverage report
150+
151+
diff-cover: coverage.xml
152+
diff-cover $^
153+
154+
diff-cover.html: coverage.xml
155+
diff-cover $^ --html-report $@
156+
157+
## test : run the ${MODULE} test suite
158+
test: FORCE
159+
python setup.py test
160+
161+
sloccount.sc: ${PYSOURCES} Makefile
162+
sloccount --duplicates --wide --details $^ > $@
163+
164+
## sloccount : count lines of code
165+
sloccount: ${PYSOURCES} Makefile
166+
sloccount $^
167+
168+
list-author-emails:
169+
@echo 'name, E-Mail Address'
170+
@git log --format='%aN,%aE' | sort -u | grep -v 'root'
171+
172+
mypy: ${PYSOURCES}
173+
MYPYPATH=typeshed/2.7 mypy --py2 --disallow-untyped-calls schema_salad
174+
175+
jenkins:
176+
if ! test -d env ; then virtualenv env ; fi
177+
. env/bin/activate ; \
178+
pip install -U setuptools pip wheel ; \
179+
${MAKE} install-dep coverage.html coverage.xml pep257_report.txt \
180+
sloccount.sc pep8_report.txt pylint_report.txt
181+
if ! test -d env3 ; then virtualenv -p python3 env3 ; fi
182+
. env3/bin/activate ; \
183+
pip install -U mypy-lang; ${MAKE} mypy
184+
185+
FORCE:

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,6 @@ provides for robust support of inline documentation.
7070
.. _JSON-LD: http://json-ld.org
7171
.. _Avro: http://avro.apache.org
7272
.. _metaschema: https://github.com/common-workflow-language/schema_salad/blob/master/schema_salad/metaschema/metaschema.yml
73-
.. _specification: https://common-workflow-language.github.io/draft-3/SchemaSalad.html
73+
.. _specification: http://www.commonwl.org/draft-3/SchemaSalad.html
7474
.. _Language: https://github.com/common-workflow-language/common-workflow-language/blob/master/draft-3/CommandLineTool.yml
7575
.. _RDF: https://www.w3.org/RDF/

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
requests
2-
PyYAML
2+
ruamel.yaml
33
rdflib >= 4.1.
44
rdflib-jsonld >= 0.3.0
55
mistune

schema_salad/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import logging
22
import sys
3-
if sys.version_info >= (2,7):
4-
import typing
3+
import typing
54

65
__author__ = '[email protected]'
76

schema_salad/__main__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from . import main
22
import sys
3-
if sys.version_info >= (2,7):
4-
import typing
3+
import typing
54

65
sys.exit(main.main())

schema_salad/add_dictlist.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import sys
2-
if sys.version_info >= (2,7):
3-
import typing
2+
from typing import Any, Dict
43

5-
def add_dictlist(di, key, val):
4+
def add_dictlist(di, key, val): # type: (Dict, Any, Any) -> None
65
if key not in di:
76
di[key] = []
87
di[key].append(val)

schema_salad/aslist.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import sys
2-
if sys.version_info >= (2,7):
3-
import typing
2+
from typing import Any, List
43

5-
def aslist(l):
4+
def aslist(l): # type: (Any) -> List
65
"""Convenience function to wrap single items and lists, and return lists unchanged."""
76

87
if isinstance(l, list):

schema_salad/flatten.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import sys
2-
if sys.version_info >= (2,7):
3-
import typing
2+
from typing import Any, Tuple
43

54
# http://rightfootin.blogspot.com/2006/09/more-on-python-flatten.html
65
def flatten(l, ltypes=(list, tuple)):
6+
# type: (Any, Any) -> Any
77
if l is None:
88
return []
99
if not isinstance(l, ltypes):
@@ -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)
24+
return ltype(l) # type: ignore

0 commit comments

Comments
 (0)