diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..0f2ac09 --- /dev/null +++ b/.flake8 @@ -0,0 +1,6 @@ +[flake8] + +exclude = .git,.pycache,build,.eggs + +# Allow longer lines due to so many JSON files +max-line-length = 88 diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml deleted file mode 100644 index ccd4dc7..0000000 --- a/.github/workflows/black.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Python Black Formatting - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - run-black: - name: Black ${{ matrix.black-version }} - - # Using matrix just to get variables which are not environmental variables - # and also to sync with other workflows which use matrix. - strategy: - matrix: - include: - - os: ubuntu-20.04 - python-version: "3.10" - black-version: "22.3.0" - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install - run: | - python -m pip install --upgrade pip - pip install black==${{ matrix.black-version }} - - - name: Run Black - run: | - black --check --diff --line-length 79 . diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml deleted file mode 100644 index 45c4012..0000000 --- a/.github/workflows/flake8.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Python code quality check - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - - flake8-actinia: - - runs-on: ubuntu-24.04 - - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: 3.8 - - name: Install - run: | - python -m pip install --upgrade pip - pip install flake8==3.8.0 - # enables config via pyproject.toml - pip install pyproject-flake8 - - name: Run Flake8 - run: | - pflake8 --count --statistics --show-source --jobs=$(nproc) . diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml new file mode 100644 index 0000000..05dc2de --- /dev/null +++ b/.github/workflows/linting.yml @@ -0,0 +1,16 @@ +--- +name: Linting and code quality check + +on: + push: + branches: + - main + - develop + pull_request: + +jobs: + lint: + uses: mundialis/github-workflows/.github/workflows/linting.yml@main + with: + # set pylint-version to empty string to skip the pylint workflow + pylint-version: '' diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index d3e24c6..b26fb8a 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -1,3 +1,4 @@ +--- name: Upload Python Package on: @@ -10,34 +11,34 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install build - - name: Build package - run: python3 -m build --outdir build . - - name: Release - uses: softprops/action-gh-release@v2 - if: startsWith(github.ref, 'refs/tags/') - with: - files: build/*.whl + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + - name: Build package + run: python3 -m build --outdir build . + - name: Release + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + files: build/*.whl - # - name: Publish package to TestPyPI - # uses: pypa/gh-action-pypi-publish@release/v1 - # with: - # password: ${{ secrets.TEST_PYPI_API_TOKEN }} - # repository_url: https://test.pypi.org/legacy/ - # packages_dir: build/ - # verbose: true + # - name: Publish package to TestPyPI + # uses: pypa/gh-action-pypi-publish@release/v1 + # with: + # password: ${{ secrets.TEST_PYPI_API_TOKEN }} + # repository_url: https://test.pypi.org/legacy/ + # packages_dir: build/ + # verbose: true - - name: Publish package - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.PYPI_API_TOKEN }} - packages_dir: build/ - verbose: true + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} + packages_dir: build/ + verbose: true diff --git a/.gitignore b/.gitignore index 19d4b9b..da6216c 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,6 @@ MANIFEST # Per-project virtualenvs .venv*/ .conda*/ + +# Linting +ruff-merged.toml diff --git a/README.md b/README.md index 55e3817..24d6efb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -API docs for actinia-core and plugins! +# API docs for actinia-core and plugins OpenAPI is a project used to describe and document RESTful APIs. actinia is using swagger2, version upgrade is on the agena. diff --git a/RELEASE.md b/RELEASE.md index 1801dff..0cb08bd 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,16 +1,16 @@ -Steps when releasing actinia-api: +# Steps when releasing actinia-api ## 0. Steps for major updates * If the release is a major update, it needs to be prepared like described in the [WIKI](https://github.com/mundialis/actinia_core/wiki/Versioning). ## 1. Prepare release and version * Run in terminal - ``` + ```bash ESTIMATED_VERSION=3.0.1 gh api repos/mundialis/actinia-api/releases/generate-notes -f tag_name="$ESTIMATED_VERSION" -f target_commitish=main -q .body ``` -* Go to https://github.com/mundialis/actinia-api/releases/new +* Go to [a new release](https://github.com/mundialis/actinia-api/releases/new) page * Copy the output of terminal command to the release description * Change heading `## What's Changed` to `### Changed`, `### Fixed`, `### Added` or what applicable and sort list amongst these headings. * You can [compare manually](https://github.com/mundialis/actinia-api/compare/3.0.0...3.0.1) if all changes are included. If changes were pushed directly to main branch, they are not included. diff --git a/docker/release/Dockerfile b/docker/release/Dockerfile deleted file mode 100644 index ed47afb..0000000 --- a/docker/release/Dockerfile +++ /dev/null @@ -1,36 +0,0 @@ -FROM alpine:edge as build - -RUN apk add git python3 postgresql-dev gcc python3-dev musl-dev - -RUN pip3 install --upgrade pip pep517 wheel - -# Build -COPY . /src/actinia-api -WORKDIR /src/actinia-api -# TODO: include tests. Currently only running whith actinia_core installed -# RUN pip3 install -r requirements.txt && python3 setup.py test -# build including dependency list from setup.cfg (automatically installed). -# pip3 wheel creates wheels out of all requirements for offline usage -RUN python3 -m pep517.build --out-dir /build . && \ - pip3 wheel -r requirements.txt -w /build - - -FROM alpine:edge - -COPY --from=build /build/actinia*.whl /build/ -COPY docker/release/create_release_with_asset.sh . - -ARG release_url=https://api.github.com/repos/mundialis/actinia-api/releases -ARG tag=0.0 -ARG credentials=dummy:dummy -ARG file=/build/actinia*.whl - -ENV env_release_url=$release_url -ENV env_tag=$tag -ENV env_credentials=$credentials -ENV env_file=$file - -RUN apk add curl jq - -ENTRYPOINT ["/bin/sh"] -CMD ["./create_release_with_asset.sh"] diff --git a/docker/release/README.md b/docker/release/README.md deleted file mode 100644 index a252e19..0000000 --- a/docker/release/README.md +++ /dev/null @@ -1,23 +0,0 @@ -### Only kept for reference - currently travis takes care of building the wheel - -To create a new release, you can use this docker to build the wheel and add -to the release. - -The `docker build` command builds the wheel and integrated the build-args for -the github release. - -The `docker run` command creates the build and uploads the -previously created wheel as asset. - - -``` -git clone git@github.com:mundialis/actinia-api.git -cd actinia-api - -tag=0.0 -credentials=mygithubuser:mygithubpw - -docker build --file docker/release/Dockerfile --build-arg tag=$tag --build-arg credentials=$credentials --tag actinia-api:build . - -docker run --rm actinia-api:build -``` diff --git a/docker/release/create_release_with_asset.sh b/docker/release/create_release_with_asset.sh deleted file mode 100644 index 62745af..0000000 --- a/docker/release/create_release_with_asset.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -# needed to be set as ENVs before: -#env_release_url -#env_tag -#env_credentials -#env_file - -filefull=`ls $env_file` -filename=$(basename $filefull) - - -echo "{\"tag_name\": \"$env_tag\",\"target_commitish\": \"master\",\"name\":\"$env_tag\",\"body\": \"Automatically created by CI\",\"draft\": false,\"prerelease\": false}" > /tmp/release_payload.json - -# Create release -curl -u $env_credentials -X POST -H 'Content-Type: application/json' -d @/tmp/release_payload.json $env_release_url > resp.json && cat resp.json - -# parse response to create upload_url -upload_url=`cat resp.json | jq '.upload_url' | tr -d '"' | cut -d '{' -f1` -url=$upload_url?name=$filename - -if [ "$upload_url" == "null" ] -then - echo "Failed to create release, aborting." - exit 1 -fi - -curl -u $env_credentials -H "Accept: application/vnd.github.manifold-preview" -H "Content-Type: application/zip" --data-binary @$filefull "$url" > resp.json && cat resp.json diff --git a/renovate.json b/renovate.json index 39a2b6e..5db72dd 100644 --- a/renovate.json +++ b/renovate.json @@ -1,6 +1,6 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": [ - "config:base" + "config:recommended" ] } diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 0000000..80fe39d --- /dev/null +++ b/ruff.toml @@ -0,0 +1,15 @@ +# Extends https://github.com/mundialis/github-workflows/blob/main/linting-config-examples/ruff.toml + +lint.ignore = [ + "BLE001", # BLE001 Do not catch blind exception: `Exception + "D205", # D205 1 blank line required between summary line and description + "E501", # E501 Line too long (ignore here, flake checks with 88 lines) + "RUF012", # RUF012 Mutable class attributes should be annotated with `typing.ClassVar` + "RUF100", # RUF100 [*] Unused `noqa` directive (non-enabled: `E501`) - needed for flake8 +] + +# [lint.per-file-ignores] +# "src/actinia_grassdata_management_plugin/apidocs/__init__.py" = [ "E501",] + +# Online ignores of +# S108 Probable insecure usage of temporary file or directory diff --git a/setup.py b/setup.py index 7f1a176..f1bcb8d 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,5 @@ +"""Setup script for actinia-api.""" + from setuptools import setup if __name__ == "__main__": diff --git a/src/actinia_api/__init__.py b/src/actinia_api/__init__.py index 2b00a6d..cfa4226 100644 --- a/src/actinia_api/__init__.py +++ b/src/actinia_api/__init__.py @@ -1,9 +1,18 @@ +"""actinia-api. +========= +actinia-api is a RESTful API for the actinia framework. It provides a +web service interface to the actinia framework, which is a geospatial +processing framework based on the GRASS GIS software. The API allows +users to access and manipulate geospatial data, run processing tasks, +and manage the underlying GRASS GIS environment. +""" + import importlib.metadata API_VERSION = "v3" # This is the URL prefix that must be used in the tests -URL_PREFIX = "/api/%s" % API_VERSION +URL_PREFIX = f"/api/{API_VERSION}" try: # Change here if project is renamed and does not equal the package name diff --git a/src/actinia_api/swagger2/__init__.py b/src/actinia_api/swagger2/__init__.py index e69de29..51f6f95 100644 --- a/src/actinia_api/swagger2/__init__.py +++ b/src/actinia_api/swagger2/__init__.py @@ -0,0 +1 @@ +"""Module containing swagger2 API documentation for actinia.""" diff --git a/src/actinia_api/swagger2/actinia_core/__init__.py b/src/actinia_api/swagger2/actinia_core/__init__.py index e69de29..fdbfcb1 100644 --- a/src/actinia_api/swagger2/actinia_core/__init__.py +++ b/src/actinia_api/swagger2/actinia_core/__init__.py @@ -0,0 +1 @@ +"""Module containing swagger2 API documentation for actinia-core.""" diff --git a/src/actinia_api/swagger2/actinia_core/apidocs/api_log_management.py b/src/actinia_api/swagger2/actinia_core/apidocs/api_log_management.py index ec454b3..26d811a 100644 --- a/src/actinia_api/swagger2/actinia_core/apidocs/api_log_management.py +++ b/src/actinia_api/swagger2/actinia_core/apidocs/api_log_management.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,14 +20,13 @@ # ####### -""" -API docs for api_log_management -""" +"""API docs for api_log_management.""" + +from actinia_core.models.response_models import SimpleResponseModel from actinia_api.swagger2.actinia_core.schemas.api_log_management import ( ApiLogListModel, ) -from actinia_core.models.response_models import SimpleResponseModel __license__ = "GPLv3" __author__ = "Sören Gebbert, Anika Weinmann" @@ -50,7 +48,7 @@ "required": True, "in": "path", "type": "string", - } + }, ], "responses": { "200": { diff --git a/src/actinia_api/swagger2/actinia_core/apidocs/download_cache_management.py b/src/actinia_api/swagger2/actinia_core/apidocs/download_cache_management.py index 5479fe0..1ae68bd 100644 --- a/src/actinia_api/swagger2/actinia_core/apidocs/download_cache_management.py +++ b/src/actinia_api/swagger2/actinia_core/apidocs/download_cache_management.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,13 +20,11 @@ # ####### -""" -API docs for download_cache_management -""" +"""API docs for download_cache_management.""" from actinia_core.models.response_models import ( - StorageResponseModel, ProcessingResponseModel, + StorageResponseModel, ) __license__ = "GPLv3" diff --git a/src/actinia_api/swagger2/actinia_core/apidocs/ephemeral_processing_with_export.py b/src/actinia_api/swagger2/actinia_core/apidocs/ephemeral_processing_with_export.py index f7375dc..c0b3102 100644 --- a/src/actinia_api/swagger2/actinia_core/apidocs/ephemeral_processing_with_export.py +++ b/src/actinia_api/swagger2/actinia_core/apidocs/ephemeral_processing_with_export.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,16 +20,13 @@ # ####### -""" -API docs for ephemeral_processing_with_export -""" +"""API docs for ephemeral_processing_with_export.""" +from actinia_core.core.common.process_chain import ProcessChainModel from actinia_core.models.response_models import ( - ProcessingResponseModel, ProcessingErrorResponseModel, + ProcessingResponseModel, ) -from actinia_core.core.common.process_chain import ProcessChainModel - __license__ = "GPLv3" __author__ = "Sören Gebbert, Anika Weinmann" diff --git a/src/actinia_api/swagger2/actinia_core/apidocs/mapset_management.py b/src/actinia_api/swagger2/actinia_core/apidocs/mapset_management.py index f09ce92..5a560a0 100644 --- a/src/actinia_api/swagger2/actinia_core/apidocs/mapset_management.py +++ b/src/actinia_api/swagger2/actinia_core/apidocs/mapset_management.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,14 +20,12 @@ # ####### -""" -API docs for mapset_management -""" +"""API docs for mapset_management.""" from actinia_core.models.response_models import ( MapsetInfoResponseModel, - ProcessingResponseModel, ProcessingErrorResponseModel, + ProcessingResponseModel, StringListProcessingResultResponseModel, ) @@ -54,7 +51,7 @@ "in": "path", "type": "string", "default": "nc_spm_08", - } + }, ], "responses": { "200": { diff --git a/src/actinia_api/swagger2/actinia_core/apidocs/mapsets.py b/src/actinia_api/swagger2/actinia_core/apidocs/mapsets.py index 0f3afd2..e9f4680 100644 --- a/src/actinia_api/swagger2/actinia_core/apidocs/mapsets.py +++ b/src/actinia_api/swagger2/actinia_core/apidocs/mapsets.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,9 +20,7 @@ # ####### -""" -API docs for mapsets -""" +"""API docs for mapsets.""" from actinia_core.models.response_models import ( LockedMapsetListResponseModel, diff --git a/src/actinia_api/swagger2/actinia_core/apidocs/persistent_processing.py b/src/actinia_api/swagger2/actinia_core/apidocs/persistent_processing.py index 04e23a9..c34e48e 100644 --- a/src/actinia_api/swagger2/actinia_core/apidocs/persistent_processing.py +++ b/src/actinia_api/swagger2/actinia_core/apidocs/persistent_processing.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,9 +20,7 @@ # ####### -""" -API docs for ephemeral_processing -""" +"""API docs for ephemeral_processing.""" from actinia_core.core.common.process_chain import ProcessChainModel from actinia_core.models.response_models import ProcessingResponseModel diff --git a/src/actinia_api/swagger2/actinia_core/apidocs/process_chain_monitoring.py b/src/actinia_api/swagger2/actinia_core/apidocs/process_chain_monitoring.py index 5428ada..4864ebb 100644 --- a/src/actinia_api/swagger2/actinia_core/apidocs/process_chain_monitoring.py +++ b/src/actinia_api/swagger2/actinia_core/apidocs/process_chain_monitoring.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,9 +20,7 @@ # ####### -""" -API docs for process_chain_monitoring -""" +"""API docs for process_chain_monitoring.""" from actinia_core.models.response_models import SimpleResponseModel @@ -32,7 +29,6 @@ MaxMapsetSizeResponseModel, ) - __license__ = "GPLv3" __author__ = "Anika Weinmann, Carmen Tawalika" __copyright__ = "Copyright 2021-2022, mundialis GmbH & Co. KG" diff --git a/src/actinia_api/swagger2/actinia_core/apidocs/process_validation.py b/src/actinia_api/swagger2/actinia_core/apidocs/process_validation.py index aca4d10..e5b6df8 100644 --- a/src/actinia_api/swagger2/actinia_core/apidocs/process_validation.py +++ b/src/actinia_api/swagger2/actinia_core/apidocs/process_validation.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,14 +20,12 @@ # ####### -""" -API docs for process_validation -""" +"""API docs for process_validation.""" from actinia_core.core.common.process_chain import ProcessChainModel from actinia_core.models.response_models import ( - ProcessingResponseModel, ProcessingErrorResponseModel, + ProcessingResponseModel, ) __license__ = "GPLv3" diff --git a/src/actinia_api/swagger2/actinia_core/apidocs/project_management.py b/src/actinia_api/swagger2/actinia_core/apidocs/project_management.py index 8ef43ac..cf0e017 100644 --- a/src/actinia_api/swagger2/actinia_core/apidocs/project_management.py +++ b/src/actinia_api/swagger2/actinia_core/apidocs/project_management.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,20 +20,17 @@ # ####### -""" -API docs for project_management -""" +"""API docs for project_management.""" from actinia_core.models.response_models import ( MapsetInfoResponseModel, ProcessingResponseModel, SimpleResponseModel, ) -from actinia_api.swagger2.actinia_core.schemas.project_management import ( - ProjectListResponseModel, -) + from actinia_api.swagger2.actinia_core.schemas.project_management import ( ProjectionInfoModel, + ProjectListResponseModel, ) __license__ = "GPLv3" @@ -72,7 +68,7 @@ "in": "path", "type": "string", "default": "nc_spm_08", - } + }, ], "responses": { "200": { @@ -98,7 +94,7 @@ "required": True, "in": "path", "type": "string", - } + }, ], "responses": { "200": { diff --git a/src/actinia_api/swagger2/actinia_core/apidocs/raster_export.py b/src/actinia_api/swagger2/actinia_core/apidocs/raster_export.py index 52d14eb..913fc34 100644 --- a/src/actinia_api/swagger2/actinia_core/apidocs/raster_export.py +++ b/src/actinia_api/swagger2/actinia_core/apidocs/raster_export.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,13 +20,11 @@ # ####### -""" -API docs for raster_export -""" +"""API docs for raster_export.""" from actinia_core.models.response_models import ( - ProcessingResponseModel, ProcessingErrorResponseModel, + ProcessingResponseModel, ) __license__ = "GPLv3" diff --git a/src/actinia_api/swagger2/actinia_core/apidocs/resource_management.py b/src/actinia_api/swagger2/actinia_core/apidocs/resource_management.py index 61dbead..a25e497 100644 --- a/src/actinia_api/swagger2/actinia_core/apidocs/resource_management.py +++ b/src/actinia_api/swagger2/actinia_core/apidocs/resource_management.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,9 +20,7 @@ # ####### -""" -API docs for resource_management -""" +"""API docs for resource_management.""" from actinia_core.core.common.process_chain import ProcessChainModel from actinia_core.models.response_models import ( @@ -209,7 +206,7 @@ "required": True, "in": "path", "type": "string", - } + }, ], "responses": { "200": { diff --git a/src/actinia_api/swagger2/actinia_core/apidocs/resource_storage_management.py b/src/actinia_api/swagger2/actinia_core/apidocs/resource_storage_management.py index ff2cc2b..c23873c 100644 --- a/src/actinia_api/swagger2/actinia_core/apidocs/resource_storage_management.py +++ b/src/actinia_api/swagger2/actinia_core/apidocs/resource_storage_management.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,9 +20,7 @@ # ####### -""" -API docs for resource_storage_management -""" +"""API docs for resource_storage_management.""" from actinia_core.models.response_models import ( ProcessingErrorResponseModel, diff --git a/src/actinia_api/swagger2/actinia_core/apidocs/user_api_key.py b/src/actinia_api/swagger2/actinia_core/apidocs/user_api_key.py index e1c3dde..850b72c 100644 --- a/src/actinia_api/swagger2/actinia_core/apidocs/user_api_key.py +++ b/src/actinia_api/swagger2/actinia_core/apidocs/user_api_key.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,9 +20,7 @@ # ####### -""" -API docs for user_api_key -""" +"""API docs for user_api_key.""" from actinia_api.swagger2.actinia_core.schemas.user_api_key import ( TokenResponseModel, @@ -66,7 +63,7 @@ "in": "query", "type": "integer", "default": 86400, - } + }, ], "responses": { "200": { diff --git a/src/actinia_api/swagger2/actinia_core/apidocs/user_management.py b/src/actinia_api/swagger2/actinia_core/apidocs/user_management.py index dafd3f1..64492f0 100644 --- a/src/actinia_api/swagger2/actinia_core/apidocs/user_management.py +++ b/src/actinia_api/swagger2/actinia_core/apidocs/user_management.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,14 +20,12 @@ # ####### -""" -API docs for user_management -""" +"""API docs for user_management.""" from actinia_core.models.response_models import ( + SimpleResponseModel, UserInfoResponseModel, UserListResponseModel, - SimpleResponseModel, ) __license__ = "GPLv3" @@ -44,7 +41,7 @@ "200": { "description": "This response returns a list of user names.", "schema": UserListResponseModel, - } + }, }, } @@ -60,7 +57,7 @@ "required": True, "in": "path", "type": "string", - } + }, ], "responses": { "200": { @@ -117,7 +114,7 @@ user_delete_doc = { "tags": ["User Management"], - "description": "Deletes a user. " "Minimum required user role: admin.", + "description": "Deletes a user. Minimum required user role: admin.", "parameters": [ { "name": "user_id", @@ -125,7 +122,7 @@ "required": True, "in": "path", "type": "string", - } + }, ], "responses": { "200": { diff --git a/src/actinia_api/swagger2/actinia_core/schemas/__init__.py b/src/actinia_api/swagger2/actinia_core/schemas/__init__.py index e69de29..b265f24 100644 --- a/src/actinia_api/swagger2/actinia_core/schemas/__init__.py +++ b/src/actinia_api/swagger2/actinia_core/schemas/__init__.py @@ -0,0 +1,3 @@ +"""Module containing schemas for the swagger2 API documentation for +actinia-core. +""" diff --git a/src/actinia_api/swagger2/actinia_core/schemas/api_log_management.py b/src/actinia_api/swagger2/actinia_core/schemas/api_log_management.py index 4a0d44d..776a566 100644 --- a/src/actinia_api/swagger2/actinia_core/schemas/api_log_management.py +++ b/src/actinia_api/swagger2/actinia_core/schemas/api_log_management.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,9 +20,7 @@ # ####### -""" -Models for api_log_management -""" +"""Models for api_log_management.""" from flask_restful_swagger_2 import Schema @@ -85,6 +82,6 @@ class ApiLogListModel(Schema): "type": "array", "items": ApiLogEntryModel, "description": "A list of ApiLogEntryModel objects", - } + }, } required = ["api_log_list"] diff --git a/src/actinia_api/swagger2/actinia_core/schemas/mapset_management.py b/src/actinia_api/swagger2/actinia_core/schemas/mapset_management.py index 35ceca0..92f879e 100644 --- a/src/actinia_api/swagger2/actinia_core/schemas/mapset_management.py +++ b/src/actinia_api/swagger2/actinia_core/schemas/mapset_management.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,10 +20,9 @@ # ####### -""" -Model for Mapset management resources -""" +"""Model for Mapset management resources.""" from copy import deepcopy + from actinia_core.models.response_models import ProcessingResponseModel __license__ = "GPLv3" @@ -36,7 +34,7 @@ class MapsetLockManagementResponseModel(ProcessingResponseModel): - """The response content that is returned by the GET request""" + """The response content that is returned by the GET request.""" type = "object" properties = deepcopy(ProcessingResponseModel.properties) diff --git a/src/actinia_api/swagger2/actinia_core/schemas/process_chain_monitoring.py b/src/actinia_api/swagger2/actinia_core/schemas/process_chain_monitoring.py index 5be4c84..1d9ad06 100644 --- a/src/actinia_api/swagger2/actinia_core/schemas/process_chain_monitoring.py +++ b/src/actinia_api/swagger2/actinia_core/schemas/process_chain_monitoring.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,9 +20,7 @@ # ####### -""" -Process Chain Monitoring -""" +"""Process Chain Monitoring.""" from flask_restful_swagger_2 import Schema __license__ = "GPLv3" @@ -33,7 +30,7 @@ class MapsetSizeResponseModel(Schema): - """Response schema for mapset sizes of a resource""" + """Response schema for mapset sizes of a resource.""" type = "object" properties = { @@ -52,7 +49,7 @@ class MapsetSizeResponseModel(Schema): class MaxMapsetSizeResponseModel(Schema): - """Response schema for maximum mapset size of a resoucre""" + """Response schema for maximum mapset size of a resoucre.""" type = "object" properties = { diff --git a/src/actinia_api/swagger2/actinia_core/schemas/project_management.py b/src/actinia_api/swagger2/actinia_core/schemas/project_management.py index b294a12..44ea9be 100644 --- a/src/actinia_api/swagger2/actinia_core/schemas/project_management.py +++ b/src/actinia_api/swagger2/actinia_core/schemas/project_management.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,9 +20,7 @@ # ####### -""" -Models for project_management -""" +"""Models for project_management.""" from flask_restful_swagger_2 import Schema @@ -34,13 +31,13 @@ ) __maintainer__ = "mundialis GmbH & Co. KG" -from actinia_core.version import init_versions, G_VERSION +from actinia_core.version import G_VERSION, init_versions init_versions() class ProjectListResponseModel(Schema): - """Response schema for projects lists""" + """Response schema for projects lists.""" type = "object" properties = { @@ -74,7 +71,7 @@ class ProjectListResponseModel(Schema): class ProjectionInfoModel(Schema): - """Schema to define projection information as JSON input in POST requests""" + """Schema to define projection information as JSON input in POST requests.""" type = "object" properties = { @@ -82,7 +79,7 @@ class ProjectionInfoModel(Schema): "type": "string", "description": "The EPSG code of the projection that should be used " "to create a project", - } + }, } example = {"epsg": "4326"} required = ["epsg"] diff --git a/src/actinia_api/swagger2/actinia_core/schemas/user_api_key.py b/src/actinia_api/swagger2/actinia_core/schemas/user_api_key.py index 54a6a1d..aa38554 100644 --- a/src/actinia_api/swagger2/actinia_core/schemas/user_api_key.py +++ b/src/actinia_api/swagger2/actinia_core/schemas/user_api_key.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,8 +20,7 @@ # ####### -""" -The user specific resources +"""The user specific resources. This module specifies all endpoints to manage user accounts in the kvdb database via REST API calls. diff --git a/src/actinia_api/swagger2/actinia_grassdata_management_plugin/__init__.py b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/__init__.py new file mode 100644 index 0000000..7789cf3 --- /dev/null +++ b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/__init__.py @@ -0,0 +1,3 @@ +"""Module containing swagger2 API documentation for +actinia-grassdata-management-plugin. +""" diff --git a/src/actinia_api/swagger2/actinia_core/apidocs/map_layer_management.py b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/map_layer_management.py similarity index 99% rename from src/actinia_api/swagger2/actinia_core/apidocs/map_layer_management.py rename to src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/map_layer_management.py index 4d9112f..e3262ee 100644 --- a/src/actinia_api/swagger2/actinia_core/apidocs/map_layer_management.py +++ b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/map_layer_management.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,9 +20,7 @@ # ####### -""" -API docs for map_layer_management -""" +"""API docs for map_layer_management.""" from actinia_core.models.response_models import ( ProcessingResponseModel, diff --git a/src/actinia_api/swagger2/actinia_core/apidocs/raster_colors.py b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/raster_colors.py similarity index 96% rename from src/actinia_api/swagger2/actinia_core/apidocs/raster_colors.py rename to src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/raster_colors.py index 1ec7065..99f787e 100644 --- a/src/actinia_api/swagger2/actinia_core/apidocs/raster_colors.py +++ b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/raster_colors.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,17 +20,15 @@ # ####### -""" -API docs for raster_colors -""" +"""API docs for raster_colors.""" from actinia_core.models.response_models import ( - ProcessingResponseModel, ProcessingErrorResponseModel, + ProcessingResponseModel, StringListProcessingResultResponseModel, ) -from actinia_api.swagger2.actinia_core.schemas.raster_colors import ( +from actinia_api.swagger2.actinia_grassdata_management_plugin.schemas.raster_colors import ( # noqa: E501 RasterColorModel, ) diff --git a/src/actinia_api/swagger2/actinia_core/apidocs/raster_layer.py b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/raster_layer.py similarity index 97% rename from src/actinia_api/swagger2/actinia_core/apidocs/raster_layer.py rename to src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/raster_layer.py index a6dbbc7..56bd707 100644 --- a/src/actinia_api/swagger2/actinia_core/apidocs/raster_layer.py +++ b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/raster_layer.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,17 +20,15 @@ # ####### -""" -API docs for raster_layer -""" +"""API docs for raster_layer.""" from actinia_core.models.response_models import ( - ProcessingResponseModel, ProcessingErrorResponseModel, + ProcessingResponseModel, ) from actinia_api import URL_PREFIX -from actinia_api.swagger2.actinia_core.schemas.raster_layer import ( +from actinia_api.swagger2.actinia_grassdata_management_plugin.schemas.raster_layer import ( # noqa: E501 RasterInfoResponseModel, ) diff --git a/src/actinia_api/swagger2/actinia_core/apidocs/raster_legend.py b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/raster_legend.py similarity index 97% rename from src/actinia_api/swagger2/actinia_core/apidocs/raster_legend.py rename to src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/raster_legend.py index 2a28c68..1f9ba1b 100644 --- a/src/actinia_api/swagger2/actinia_core/apidocs/raster_legend.py +++ b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/raster_legend.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,9 +20,7 @@ # ####### -""" -API docs for raster_legend -""" +"""API docs for raster_legend.""" from actinia_core.models.response_models import ( ProcessingErrorResponseModel, diff --git a/src/actinia_api/swagger2/actinia_core/apidocs/raster_renderer.py b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/raster_renderer.py similarity index 99% rename from src/actinia_api/swagger2/actinia_core/apidocs/raster_renderer.py rename to src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/raster_renderer.py index 7f5ec17..f59234a 100644 --- a/src/actinia_api/swagger2/actinia_core/apidocs/raster_renderer.py +++ b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/raster_renderer.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,9 +20,7 @@ # ####### -""" -API docs for raster_renderer -""" +"""API docs for raster_renderer.""" from actinia_core.models.response_models import ( ProcessingErrorResponseModel, diff --git a/src/actinia_api/swagger2/actinia_core/apidocs/strds_management.py b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/strds_management.py similarity index 97% rename from src/actinia_api/swagger2/actinia_core/apidocs/strds_management.py rename to src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/strds_management.py index aabe191..ed75289 100644 --- a/src/actinia_api/swagger2/actinia_core/apidocs/strds_management.py +++ b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/strds_management.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,9 +20,7 @@ # ####### -""" -API docs for strds_management -""" +"""API docs for strds_management.""" from actinia_core.models.response_models import ( ProcessingErrorResponseModel, @@ -31,7 +28,7 @@ StringListProcessingResultResponseModel, ) -from actinia_api.swagger2.actinia_core.schemas.strds_management import ( +from actinia_api.swagger2.actinia_grassdata_management_plugin.schemas.strds_management import ( # noqa: E501 STRDSCreationModel, STRDSInfoResponseModel, ) diff --git a/src/actinia_api/swagger2/actinia_core/apidocs/strds_raster_management.py b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/strds_raster_management.py similarity index 97% rename from src/actinia_api/swagger2/actinia_core/apidocs/strds_raster_management.py rename to src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/strds_raster_management.py index ade128e..25f7a05 100644 --- a/src/actinia_api/swagger2/actinia_core/apidocs/strds_raster_management.py +++ b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/strds_raster_management.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,18 +20,16 @@ # ####### -""" -API docs for strds_raster_management -""" +"""API docs for strds_raster_management.""" from actinia_core.models.response_models import ( ProcessingErrorResponseModel, ProcessingResponseModel, ) -from actinia_api.swagger2.actinia_core.schemas.strds_raster_management import ( - STRDSRasterListResponseModel, +from actinia_api.swagger2.actinia_grassdata_management_plugin.schemas.strds_raster_management import ( # noqa: E501 RasterListRegisterModel, + STRDSRasterListResponseModel, ) __license__ = "GPLv3" diff --git a/src/actinia_api/swagger2/actinia_core/apidocs/strds_renderer.py b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/strds_renderer.py similarity index 98% rename from src/actinia_api/swagger2/actinia_core/apidocs/strds_renderer.py rename to src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/strds_renderer.py index 9ed99b5..a5d463d 100644 --- a/src/actinia_api/swagger2/actinia_core/apidocs/strds_renderer.py +++ b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/strds_renderer.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,9 +20,7 @@ # ####### -""" -API docs for strds_renderer -""" +"""API docs for strds_renderer.""" from actinia_core.models.response_models import ( ProcessingErrorResponseModel, diff --git a/src/actinia_api/swagger2/actinia_core/apidocs/vector_layer.py b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/vector_layer.py similarity index 97% rename from src/actinia_api/swagger2/actinia_core/apidocs/vector_layer.py rename to src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/vector_layer.py index be45152..bf09ba1 100644 --- a/src/actinia_api/swagger2/actinia_core/apidocs/vector_layer.py +++ b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/vector_layer.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,9 +20,7 @@ # ####### -""" -API docs for vector_layer -""" +"""API docs for vector_layer.""" from actinia_core.models.response_models import ( ProcessingErrorResponseModel, @@ -31,7 +28,7 @@ ) from actinia_api import URL_PREFIX -from actinia_api.swagger2.actinia_core.schemas.vector_layer import ( +from actinia_api.swagger2.actinia_grassdata_management_plugin.schemas.vector_layer import ( # noqa: E501 VectorInfoResponseModel, VectorRegionCreationModel, ) diff --git a/src/actinia_api/swagger2/actinia_core/apidocs/vector_renderer.py b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/vector_renderer.py similarity index 98% rename from src/actinia_api/swagger2/actinia_core/apidocs/vector_renderer.py rename to src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/vector_renderer.py index 596f1f9..ff38ed0 100644 --- a/src/actinia_api/swagger2/actinia_core/apidocs/vector_renderer.py +++ b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/apidocs/vector_renderer.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,9 +20,7 @@ # ####### -""" -API docs for vector_renderer -""" +"""API docs for vector_renderer.""" from actinia_core.models.response_models import ( ProcessingErrorResponseModel, diff --git a/src/actinia_api/swagger2/actinia_grassdata_management_plugin/schemas/__init__.py b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/schemas/__init__.py new file mode 100644 index 0000000..db8a8b1 --- /dev/null +++ b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/schemas/__init__.py @@ -0,0 +1,3 @@ +"""Module containing schemas for the swagger2 API documentation for This module +contains the swagger2 API documentation for actinia-grassdata-management-plugin. +""" diff --git a/src/actinia_api/swagger2/actinia_core/schemas/map_layer_base.py b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/schemas/map_layer_base.py similarity index 96% rename from src/actinia_api/swagger2/actinia_core/schemas/map_layer_base.py rename to src/actinia_api/swagger2/actinia_grassdata_management_plugin/schemas/map_layer_base.py index 8de0231..23d9947 100644 --- a/src/actinia_api/swagger2/actinia_core/schemas/map_layer_base.py +++ b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/schemas/map_layer_base.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,9 +20,7 @@ # ####### -""" -Model for Base layer resources -""" +"""Model for Base layer resources.""" from flask_restful_swagger_2 import Schema @@ -36,7 +33,7 @@ class SetRegionModel(Schema): - """This schema represents the computational region definition for raster + """Schema representing the computational region definition for raster and vector map layers. n : for north diff --git a/src/actinia_api/swagger2/actinia_core/schemas/raster_colors.py b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/schemas/raster_colors.py similarity index 96% rename from src/actinia_api/swagger2/actinia_core/schemas/raster_colors.py rename to src/actinia_api/swagger2/actinia_grassdata_management_plugin/schemas/raster_colors.py index 20fb069..4d2b7d3 100644 --- a/src/actinia_api/swagger2/actinia_core/schemas/raster_colors.py +++ b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/schemas/raster_colors.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,9 +20,7 @@ # ####### -""" -Models for Raster colors management -""" +"""Models for Raster colors management.""" from flask_restful_swagger_2 import Schema diff --git a/src/actinia_api/swagger2/actinia_core/schemas/raster_layer.py b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/schemas/raster_layer.py similarity index 96% rename from src/actinia_api/swagger2/actinia_core/schemas/raster_layer.py rename to src/actinia_api/swagger2/actinia_grassdata_management_plugin/schemas/raster_layer.py index 111284a..c0a579b 100644 --- a/src/actinia_api/swagger2/actinia_core/schemas/raster_layer.py +++ b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/schemas/raster_layer.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,12 +20,11 @@ # ####### -""" -Raster layer resources -""" +"""Raster layer resources.""" from copy import deepcopy -from flask_restful_swagger_2 import Schema + from actinia_core.models.response_models import ProcessingResponseModel +from flask_restful_swagger_2 import Schema __license__ = "GPLv3" __author__ = "Sören Gebbert, Carmen Tawalika" @@ -37,7 +35,7 @@ class RasterInfoModel(Schema): - """Schema that contains raster map layer information""" + """Schema that contains raster map layer information.""" type = "object" properties = { @@ -79,7 +77,7 @@ class RasterInfoModel(Schema): 'project="northcarolina_latlong" mapset="\\helena" ' 'output="elev_ned10m" method="cubic" resolution=10"', "creator": '"helena"', - "database": "/tmp/gisdbase_75bc0828", + "database": "/tmp/gisdbase_75bc0828", # noqa: S108 "datatype": "FCELL", "date": '"Tue Nov 7 01:09:51 2006"', "description": '"generated by r.proj"', @@ -133,8 +131,8 @@ class RasterInfoResponseModel(ProcessingResponseModel): "flags": "gre", "inputs": {"map": "elevation@PERMANENT"}, "module": "r.info", - } - } + }, + }, ], "process_log": [ { @@ -144,7 +142,7 @@ class RasterInfoResponseModel(ProcessingResponseModel): "run_time": 0.050168514251708984, "stderr": [""], "stdout": "...", - } + }, ], "process_results": { "cells": "2025000", diff --git a/src/actinia_api/swagger2/actinia_core/schemas/strds_management.py b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/schemas/strds_management.py similarity index 98% rename from src/actinia_api/swagger2/actinia_core/schemas/strds_management.py rename to src/actinia_api/swagger2/actinia_grassdata_management_plugin/schemas/strds_management.py index 86010c4..91cc622 100644 --- a/src/actinia_api/swagger2/actinia_core/schemas/strds_management.py +++ b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/schemas/strds_management.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,14 +20,14 @@ # ####### -""" -STRDS map layer management +"""STRDS map layer management. TODO: Integrate into the ephemeral process chain approach """ from copy import deepcopy -from flask_restful_swagger_2 import Schema + from actinia_core.models.response_models import ProcessingResponseModel +from flask_restful_swagger_2 import Schema __license__ = "GPLv3" __author__ = "Sören Gebbert, Carmen Tawalika" @@ -39,7 +38,7 @@ class STRDSInfoModel(Schema): - """Schema that contains space-time raster dataset (STRDS) information""" + """Schema that contains space-time raster dataset (STRDS) information.""" description = ( "Information about a specific space-time raster dataset (STRDS)" @@ -145,8 +144,8 @@ class STRDSInfoResponseModel(ProcessingResponseModel): "type": "strds", }, "module": "t.info", - } - } + }, + }, ], "process_log": [ { @@ -160,7 +159,7 @@ class STRDSInfoResponseModel(ProcessingResponseModel): "run_time": 0.4944636821746826, "stderr": [""], "stdout": "...", - } + }, ], "process_results": { "aggregation_type": "None", @@ -210,7 +209,7 @@ class STRDSInfoResponseModel(ProcessingResponseModel): class STRDSCreationModel(Schema): - """Schema for STRDS creation""" + """Schema for STRDS creation.""" description = "Information required to create a new STRDS" type = "object" diff --git a/src/actinia_api/swagger2/actinia_core/schemas/strds_raster_management.py b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/schemas/strds_raster_management.py similarity index 95% rename from src/actinia_api/swagger2/actinia_core/schemas/strds_raster_management.py rename to src/actinia_api/swagger2/actinia_grassdata_management_plugin/schemas/strds_raster_management.py index d222248..e4a892b 100644 --- a/src/actinia_api/swagger2/actinia_core/schemas/strds_raster_management.py +++ b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/schemas/strds_raster_management.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,14 +20,14 @@ # ####### -""" -STRDS raster map layer management +"""STRDS raster map layer management. TODO: Integrate into the ephemeral process chain approach """ from copy import deepcopy -from flask_restful_swagger_2 import Schema + from actinia_core.models.response_models import ProcessingResponseModel +from flask_restful_swagger_2 import Schema __license__ = "GPLv3" __author__ = "Sören Gebbert, Carmen Tawalika" @@ -39,7 +38,7 @@ class STRDSRasterListEntryModel(Schema): - """Schema that contains list entry + """Schema that contains list entry. columns=id,start_time,end_time,north,south,east,west,min,max,rows,cols """ @@ -115,11 +114,11 @@ class STRDSRasterListResponseModel(ProcessingResponseModel): "output": { "name": "/home/soeren/actinia/workspace/temp_db/" "gisdbase_1b72938d2ef54c199f6627b8720f21e1/" - ".tmp/tmptps71vn7" - } + ".tmp/tmptps71vn7", + }, }, - } - } + }, + }, ], "process_log": [ { @@ -138,7 +137,7 @@ class STRDSRasterListResponseModel(ProcessingResponseModel): "run_time": 0.5023984909057617, "stderr": [""], "stdout": "", - } + }, ], "process_results": [ { @@ -196,6 +195,8 @@ class STRDSRasterListResponseModel(ProcessingResponseModel): class RasterListEntryModel(Schema): + """Schema for items for RasterListRegisterModel.""" + type = "object" properties = { "name": {"type": "string"}, @@ -205,6 +206,8 @@ class RasterListEntryModel(Schema): class RasterListRegisterModel(Schema): + """Schema for the list of raster map layers to be registered.""" + type = "array" items = RasterListEntryModel example = [ diff --git a/src/actinia_api/swagger2/actinia_core/schemas/vector_layer.py b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/schemas/vector_layer.py similarity index 96% rename from src/actinia_api/swagger2/actinia_core/schemas/vector_layer.py rename to src/actinia_api/swagger2/actinia_grassdata_management_plugin/schemas/vector_layer.py index eae4e12..7f8762a 100644 --- a/src/actinia_api/swagger2/actinia_core/schemas/vector_layer.py +++ b/src/actinia_api/swagger2/actinia_grassdata_management_plugin/schemas/vector_layer.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ####### # actinia-core - an open source REST API for scalable, distributed, high # performance processing of geographical data that uses GRASS GIS for @@ -21,14 +20,14 @@ # ####### -""" -Vector layer resources -""" -import random +"""Vector layer resources.""" +import secrets from copy import deepcopy -from flask_restful_swagger_2 import Schema + from actinia_core.models.response_models import ProcessingResponseModel -from actinia_api.swagger2.actinia_core.schemas.map_layer_base import ( +from flask_restful_swagger_2 import Schema + +from actinia_api.swagger2.actinia_grassdata_management_plugin.schemas.map_layer_base import ( # noqa: E501 SetRegionModel, ) @@ -41,7 +40,7 @@ class VectorAttributeModel(Schema): - """Simple model that represent the description of vector attributes""" + """Simple model that represent the description of vector attributes.""" description = "Description of a vector map layer attribute" type = "object" @@ -50,7 +49,7 @@ class VectorAttributeModel(Schema): class VectorInfoModel(Schema): - """Schema that contains vector map layer information""" + """Schema that contains vector map layer information.""" description = "Description of a GRASS GIS vector map layer" type = "object" @@ -115,7 +114,7 @@ class VectorInfoModel(Schema): "centroids": "0", "comment": "", "creator": "soeren", - "database": "/tmp/gisdbase_b83bebdb543440c7b9991e2e5602ba91", + "database": "/tmp/gisdbase_b83bebdb543440c7b9991e2e5602ba91", # noqa: S108 "digitization_threshold": "0.000000", "east": "644375.544828422", "faces": "0", @@ -145,7 +144,7 @@ class VectorInfoModel(Schema): "top": "1.000000", "volumes": "0", "west": "644375.544828422", - "attribute_database": "/tmp/gisdbase_eabed7327ec84d219698670884136c2a/" + "attribute_database": "/tmp/gisdbase_eabed7327ec898670884136c2a/" # noqa: S108 "nc_spm_08/user1/vector/test_layer/sqlite.db", "attribute_database_driver": "sqlite", "attribute_layer_name": "test_layer", @@ -193,7 +192,7 @@ class VectorInfoResponseModel(ProcessingResponseModel): "inputs": {"map": "geology@PERMANENT"}, "module": "v.info", }, - } + }, ], "process_log": [ { @@ -297,7 +296,7 @@ class VectorInfoResponseModel(ProcessingResponseModel): class VectorCreationModel(Schema): - """Schema for input parameters to generate a random point vector map layer""" + """Schema for input parameters to generate a random point vector map layer.""" type = "object" properties = { @@ -312,7 +311,7 @@ class VectorCreationModel(Schema): "format": "integer", "description": "The seed to initialize the random generator. " "If not set the process ID is used", - "default": random.randint(0, 1000000), + "default": secrets.randbelow(1000000), }, "zmin": { "type": "number", @@ -330,7 +329,7 @@ class VectorCreationModel(Schema): class VectorRegionCreationModel(Schema): - """Schema for random vector generation in a specific region""" + """Schema for random vector generation in a specific region.""" type = "object" properties = {"region": SetRegionModel, "parameter": VectorCreationModel}