Skip to content

Commit 2804254

Browse files
committed
refactor: Reintroduce linting to __init__ files
By only ignoring error 401 ("imported but unused") we can lint these files for any other issues.
1 parent a4fe4cd commit 2804254

File tree

5 files changed

+19
-20
lines changed

5 files changed

+19
-20
lines changed

.flake8

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[flake8]
22
max-line-length = 88
3-
extend-ignore = E203, W503, E731, E722
3+
extend-ignore = E203, W503, E731, E722
4+
per-file-ignores = __init__.py:F401

pystac/__init__.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
PySTAC is a library for working with SpatioTemporal Asset Catalogs (STACs)
33
"""
44

5-
# flake8: noqa
65
from pystac.errors import (
76
STACError,
87
STACTypeError,
@@ -113,12 +112,12 @@ def write_file(
113112
"""Writes a STACObject to a file.
114113
115114
This will write only the Catalog, Collection or Item ``obj``. It will not attempt
116-
to write any other objects that are linked to ``obj``; if you'd like functionality to
117-
save off catalogs recursively see :meth:`Catalog.save <pystac.Catalog.save>`.
115+
to write any other objects that are linked to ``obj``; if you'd like functionality
116+
to save off catalogs recursively see :meth:`Catalog.save <pystac.Catalog.save>`.
118117
119-
This method will write the JSON of the object to the object's assigned "self" link or
120-
to the dest_href if provided. To set the self link, see :meth:`STACObject.set_self_href
121-
<pystac.STACObject.set_self_href>`.
118+
This method will write the JSON of the object to the object's assigned "self" link
119+
or to the dest_href if provided. To set the self link, see
120+
:meth:`STACObject.set_self_href <pystac.STACObject.set_self_href>`.
122121
123122
Convenience method for :meth:`STACObject.from_file <pystac.STACObject.from_file>`
124123

pystac/serialization/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# flake8: noqa
21
from pystac.serialization.identify import (
32
STACVersionRange,
43
identify_stac_object,

pystac/validation/__init__.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# flake8: noqa
21
from typing import Dict, List, Any, Optional, cast, TYPE_CHECKING
32

43
import pystac
@@ -47,17 +46,19 @@ def validate_dict(
4746
) -> List[Any]:
4847
"""Validate a stac object serialized as JSON into a dict.
4948
50-
This method delegates to the call to :meth:`pystac.validation.STACValidator.validate`
51-
for the STACValidator registered via :meth:`~pystac.validation.set_validator` or
49+
This method delegates to the call to
50+
:meth:`pystac.validation.STACValidator.validate` for the STACValidator registered
51+
via :meth:`~pystac.validation.set_validator` or
5252
:class:`~pystac.validation.JsonSchemaSTACValidator` by default.
5353
5454
Args:
5555
stac_dict : Dictionary that is the STAC json of the object.
5656
stac_object_type : The stac object type of the object encoded in stac_dict.
5757
One of :class:`~pystac.STACObjectType`. If not supplied, this will use
5858
PySTAC's identification logic to identify the object type.
59-
stac_version : The version of STAC to validate the object against. If not supplied,
60-
this will use PySTAC's identification logic to identify the stac version
59+
stac_version : The version of STAC to validate the object against. If not
60+
supplied, this will use PySTAC's identification logic to identify the stac
61+
version
6162
extensions : Extension IDs for this stac object. If not supplied,
6263
PySTAC's identification logic to identify the extensions.
6364
href : Optional HREF of the STAC object being validated.
@@ -120,8 +121,8 @@ def validate_all(
120121
the StacIO.default() instance is used.
121122
122123
Raises:
123-
STACValidationError: This will raise a STACValidationError if this or any contained
124-
catalog, collection or item has a validation error.
124+
STACValidationError: This will raise a STACValidationError if this or any
125+
contained catalog, collection or item has a validation error.
125126
"""
126127
if stac_io is None:
127128
stac_io = pystac.StacIO.default()
@@ -165,9 +166,10 @@ def get_validator(cls) -> STACValidator:
165166
import jsonschema
166167
except ImportError:
167168
raise Exception(
168-
'Cannot validate with default validator because package "jsonschema" '
169-
"is not installed. Install pystac with the validation optional requirements "
170-
"(e.g. pip install pystac[validation]) to install jsonschema"
169+
"Cannot validate with default validator because package"
170+
' "jsonschema" is not installed. Install pystac with the validation'
171+
" optional requirements (e.g. pip install pystac[validation]) to"
172+
" install jsonschema"
171173
)
172174
cls._validator = JsonSchemaSTACValidator()
173175

tests/utils/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# flake8: noqa
2-
31
from typing import Any, Dict, TYPE_CHECKING, Type
42
import unittest
53
from tests.utils.test_cases import (

0 commit comments

Comments
 (0)