Skip to content

Commit 7d067bb

Browse files
author
Phil Varner
committed
updates
1 parent f09be8f commit 7d067bb

File tree

8 files changed

+318
-271
lines changed

8 files changed

+318
-271
lines changed

.flake8

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[flake8]
2+
select = B,B9,C,D,DAR,E,F,N,RST,S,W
3+
ignore = E203,E501,RST201,RST203,RST301,W503,C901
4+
max-line-length = 80
5+
max-complexity = 10
6+
docstring-convention = google
7+
per-file-ignores = tests/*:S101
8+
rst-roles = class,const,func,meth,mod,ref
9+
rst-directives = deprecated

.pre-commit-config.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Configuration file for pre-commit (https://pre-commit.com/).
2+
# Please run `pre-commit run --all-files` when adding or changing entries.
3+
4+
repos:
5+
- repo: local
6+
hooks:
7+
- id: black
8+
name: black
9+
entry: black
10+
language: system
11+
stages: [commit]
12+
types: [python]
13+
14+
- id: flake8
15+
name: flake8
16+
entry: flake8
17+
language: system
18+
stages: [commit]
19+
types: [python]
20+
21+
# - id: mypy
22+
# name: mypy
23+
# entry: mypy
24+
# args: [--no-incremental]
25+
# language: system
26+
# stages: [commit]
27+
# types: [python]
28+
# require_serial: true

requirements-dev.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
black
2+
flake8
3+
isort
4+
mypy

requirements-test.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pystac-client==v0.3.0
2+
requests
3+
pystac
4+
pystac[validation]
5+
pytest
6+
pytest-cov

requirements.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,3 @@ pystac-client==v0.3.0
22
requests
33
pystac
44
pystac[validation]
5-
pytest
6-
pytest-cov

stac_api_validator/geometries.py

Lines changed: 17 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,44 @@
1-
point = {
2-
"type": "Point",
3-
"coordinates": [100.0, 0.0]
4-
}
1+
point = {"type": "Point", "coordinates": [100.0, 0.0]}
52

6-
linestring = {
7-
"type": "LineString",
8-
"coordinates": [
9-
[100.0, 0.0],
10-
[101.0, 1.0]
11-
]
12-
}
3+
linestring = {"type": "LineString", "coordinates": [[100.0, 0.0], [101.0, 1.0]]}
134

145
polygon = {
156
"type": "Polygon",
167
"coordinates": [
17-
[
18-
[100.0, 0.0],
19-
[101.0, 0.0],
20-
[101.0, 1.0],
21-
[100.0, 1.0],
22-
[100.0, 0.0]
23-
]
24-
]
8+
[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]
9+
],
2510
}
2611

2712
polygon_with_hole = {
2813
"type": "Polygon",
2914
"coordinates": [
30-
[
31-
[100.0, 0.0],
32-
[101.0, 0.0],
33-
[101.0, 1.0],
34-
[100.0, 1.0],
35-
[100.0, 0.0]
36-
],
37-
[
38-
[100.8, 0.8],
39-
[100.8, 0.2],
40-
[100.2, 0.2],
41-
[100.2, 0.8],
42-
[100.8, 0.8]
43-
]
44-
]
15+
[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]],
16+
[[100.8, 0.8], [100.8, 0.2], [100.2, 0.2], [100.2, 0.8], [100.8, 0.8]],
17+
],
4518
}
4619

47-
multipoint = {
48-
"type": "MultiPoint",
49-
"coordinates": [
50-
[100.0, 0.0],
51-
[101.0, 1.0]
52-
]
53-
}
20+
multipoint = {"type": "MultiPoint", "coordinates": [[100.0, 0.0], [101.0, 1.0]]}
5421

5522
multilinestring = {
5623
"type": "MultiLineString",
57-
"coordinates": [
58-
[
59-
[100.0, 0.0],
60-
[101.0, 1.0]
61-
],
62-
[
63-
[102.0, 2.0],
64-
[103.0, 3.0]
65-
]
66-
]
24+
"coordinates": [[[100.0, 0.0], [101.0, 1.0]], [[102.0, 2.0], [103.0, 3.0]]],
6725
}
6826

6927
multipolygon = {
7028
"type": "MultiPolygon",
7129
"coordinates": [
30+
[[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]],
7231
[
73-
[
74-
[102.0, 2.0],
75-
[103.0, 2.0],
76-
[103.0, 3.0],
77-
[102.0, 3.0],
78-
[102.0, 2.0]
79-
]
32+
[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]],
33+
[[100.2, 0.2], [100.2, 0.8], [100.8, 0.8], [100.8, 0.2], [100.2, 0.2]],
8034
],
81-
[
82-
[
83-
[100.0, 0.0],
84-
[101.0, 0.0],
85-
[101.0, 1.0],
86-
[100.0, 1.0],
87-
[100.0, 0.0]
88-
],
89-
[
90-
[100.2, 0.2],
91-
[100.2, 0.8],
92-
[100.8, 0.8],
93-
[100.8, 0.2],
94-
[100.2, 0.2]
95-
]
96-
]
97-
]
35+
],
9836
}
9937

10038
geometry_collection = {
10139
"type": "GeometryCollection",
102-
"geometries": [{
103-
"type": "Point",
104-
"coordinates": [100.0, 0.0]
105-
}, {
106-
"type": "LineString",
107-
"coordinates": [
108-
[101.0, 0.0],
109-
[102.0, 1.0]
110-
]
111-
}]
40+
"geometries": [
41+
{"type": "Point", "coordinates": [100.0, 0.0]},
42+
{"type": "LineString", "coordinates": [[101.0, 0.0], [102.0, 1.0]]},
43+
],
11244
}

stac_api_validator/validate.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
def parse_args(args):
99
parser = argparse.ArgumentParser(description="STAC API Validation Suite")
1010
# todo: validate logging is one of these values
11-
parser.add_argument("--logging", default="INFO",
12-
help="DEBUG, INFO, WARN, ERROR, CRITICAL")
11+
parser.add_argument(
12+
"--logging", default="INFO", help="DEBUG, INFO, WARN, ERROR, CRITICAL"
13+
)
1314
parser.add_argument("--root", help="STAC API Root / Landing Page URL")
1415
parser.add_argument(
1516
"--post",
1617
help="Also use POST method for requests",
1718
action=argparse.BooleanOptionalAction,
18-
default=True
19+
default=True,
1920
)
2021

2122
return parser.parse_args(args)

0 commit comments

Comments
 (0)