Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Commit

Permalink
more linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fmigneault committed Apr 18, 2024
1 parent 5de6693 commit 7f7620c
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 24 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,10 @@ jobs:
- name: Install dependencies
run: make install-dev

- name: Run style checks
- name: Run checks
run: |
make lint
make lint-all
- name: Run tests
run: |
make test
- name: Run safety checks
run: |
make check-safety
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
- uses: actions/checkout@v2
- run: |
npm install
npm test
npm test
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ format-examples: install-npm
fix-%: format-%s

.PHONY: lint-all
lint: test lint mypy check-safety check-markdown
lint-all: lint mypy check-safety check-markdown

.PHONY: update-dev-deps
update-dev-deps:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ connectors, please refer to the [STAC Model](README_STAC_MODEL.md) document.
> FIXME: update examples
- Examples:
- [Example with a ??? trained with torchgeo](examples/item.json) TODO update example
- **Example with a ??? trained with torchgeo** :warning: TODO update example
- [Collection example](examples/collection.json): Shows the basic usage of the extension in a STAC Collection
- [JSON Schema](json-schema/schema.json) TODO update
- [Changelog](./CHANGELOG.md)
Expand Down
16 changes: 12 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ exclude = [
"build",
"dist",
"env",
"venv"
"venv",
"node_modules",
]
respect-gitignore = true
line-length = 120
Expand Down Expand Up @@ -159,7 +160,9 @@ warn_required_dynamic_aliases = true
# https://github.com/PyCQA/pydocstyle
# http://www.pydocstyle.org/en/stable/usage.html#available-options
convention = "google"

match_dir = "^(stac_model|tests)"
# ignore missing documentation, just validate provided ones
add_ignore = "D100,D101,D102,D103,D104,D105,D107,D200,D202,D204,D212,D401"

[tool.pydoclint]
# https://github.com/jsh9/pydoclint
Expand All @@ -179,9 +182,13 @@ exclude = '''
| dist
| env
| venv
| node_modules
)/
'''

# don't require type hints, since we have them in the signature instead (don't duplicate)
arg-type-hints-in-docstring = false
arg-type-hints-in-signature = true
check-return-types = false

[tool.pytest.ini_options]
# https://github.com/pytest-dev/pytest
Expand All @@ -196,7 +203,8 @@ norecursedirs =[
"docs",
".tox",
".git",
"__pycache__"
"__pycache__",
"node_modules",
]
doctest_optionflags = ["NUMBER", "NORMALIZE_WHITESPACE", "IGNORE_EXCEPTION_DETAIL"]
timeout = 1000
Expand Down
4 changes: 3 additions & 1 deletion stac_model/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""A PydanticV2 validation and serialization library for the STAC ML Model Extension"""
"""
A PydanticV2/PySTAC validation and serialization library for the STAC Machine Learning Model Extension.
"""

from importlib import metadata

Expand Down
34 changes: 24 additions & 10 deletions stac_model/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ def apply(
self,
properties: Union[MLModelProperties, dict[str, Any]],
) -> None:
"""Applies Machine Learning Model Extension properties to the extended
:class:`~pystac.Item` or :class:`~pystac.Asset`.
"""
Applies Machine Learning Model Extension properties to the extended :mod:`~pystac` object.
"""
if isinstance(properties, dict):
properties = MLModelProperties(**properties)
Expand Down Expand Up @@ -122,14 +122,19 @@ def ext(
"ItemMLModelExtension",
"AssetMLModelExtension",
]:
"""Extends the given STAC Object with properties from the
:stac-ext:`Machine Learning Model Extension <mlm>`.
"""
Extends the given STAC Object with properties from the :stac-ext:`Machine Learning Model Extension <mlm>`.
This extension can be applied to instances of :class:`~pystac.Item` or
:class:`~pystac.Asset`.
This extension can be applied to instances of :class:`~pystac.Item` or :class:`~pystac.Asset`.
Raises:
Args:
obj: STAC Object to extend with the MLM extension fields.
add_if_missing: Add the MLM extension schema URI to the object if not already in `stac_extensions`.
Returns:
Extended object.
Raises:
pystac.ExtensionTypeError : If an invalid object type is passed.
"""
if isinstance(obj, pystac.Collection):
Expand All @@ -155,7 +160,10 @@ def summaries(cls, obj: pystac.Collection, add_if_missing: bool = False) -> "Sum


class SummariesMLModelExtension(SummariesExtension):
"""A concrete implementation of :class:`~SummariesExtension` that extends
"""
Summaries annotated with the Machine Learning Model Extension.
A concrete implementation of :class:`~SummariesExtension` that extends
the ``summaries`` field of a :class:`~pystac.Collection` to include properties
defined in the :stac-ext:`Machine Learning Model <mlm>`.
"""
Expand Down Expand Up @@ -192,7 +200,10 @@ def __setattr__(self, prop, value):


class ItemMLModelExtension(MLModelExtension[pystac.Item]):
"""A concrete implementation of :class:`MLModelExtension` on an
"""
Item annotated with the Machine Learning Model Extension.
A concrete implementation of :class:`MLModelExtension` on an
:class:`~pystac.Item` that extends the properties of the Item to
include properties defined in the :stac-ext:`Machine Learning Model
Extension <mlm>`.
Expand All @@ -219,7 +230,10 @@ def __repr__(self) -> str:


class AssetMLModelExtension(MLModelExtension[pystac.Asset]):
"""A concrete implementation of :class:`MLModelExtension` on an
"""
Asset annotated with the Machine Learning Model Extension.
A concrete implementation of :class:`MLModelExtension` on an
:class:`~pystac.Asset` that extends the Asset fields to include
properties defined in the :stac-ext:`Machine Learning Model
Extension <mlm>`.
Expand Down

0 comments on commit 7f7620c

Please sign in to comment.