Skip to content

Commit 510a01f

Browse files
author
Peter Amstutz
committed
Merge commit '8823aaa11432aa042b3e307891e71ee13e11bfd7' into scoped-ref-and-typedsl
2 parents f36f52f + 8823aaa commit 510a01f

Some content is hidden

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

83 files changed

+3718
-564
lines changed

draft-4/salad/.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

draft-4/salad/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+
# Contact: common-workflow-language@googlegroups.com
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:

draft-4/salad/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/

draft-4/salad/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

draft-4/salad/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__ = 'peter.amstutz@curoverse.com'
76

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())
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)

draft-4/salad/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):

draft-4/salad/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)