Skip to content

Commit

Permalink
openeo GRASS driver: continue linting (#82)
Browse files Browse the repository at this point in the history
* F821
* F841
  • Loading branch information
metzm authored Mar 31, 2021
1 parent f01d40b commit 02e896b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 47 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from random import randint
import json

from openeo_grass_gis_driver.models.process_graph_schemas import \
Expand Down Expand Up @@ -93,6 +94,7 @@ def create_process_description():
"data": p_data,
"geometries": p_geometries,
"reducer": p_reducer,
"target_dimension": p_target_dimension,
"context": p_context},
returns=rv,
examples=examples)
Expand Down Expand Up @@ -185,6 +187,7 @@ def create_process_chain_entry(input_object: DataObject, geometries: str):
pc.append(importer)
pc.append(g_region_1)
pc.append(g_region_2)
pc.append(v_to_rast_1)
pc.append(r_mask_1)
pc.append(t_rast_univar)
pc.append(r_mask_2)
Expand Down Expand Up @@ -216,8 +219,8 @@ def get_process_list(node: Node):
raise Exception(
"The vector geometries are missing in the process description")

reducer = node.arguments["reducer"]
# TODO: parse the reducer
# TODO: support a reducer
# reducer = node.arguments["reducer"]

pc = create_process_chain_entry(input_object=input_object,
geometries=geometries)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ def get_process_list(node: Node):
PROCESS_NAME)

input_objects = node.get_parent_by_name(parent_name="data").output_objects
vector_objects = node.arguments["polygons"]
vector_object = node.arguments["polygons"]

if not input_objects:
raise Exception("Process %s requires an input strds" % PROCESS_NAME)

if not vector_objects:
if not vector_object:
raise Exception("Process %s requires an input vector" % PROCESS_NAME)

input_object = list(input_objects)[-1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def create_process_description():


def create_process_chain_entry(input_object: DataObject, vector_object,
inside, output_object: DataObject):
mask_value, inside, output_object: DataObject):
"""Create a Actinia command of the process chain
:param input_object:
Expand Down Expand Up @@ -199,7 +199,7 @@ def get_process_list(node: Node):
inside = True

input_objects = node.get_parent_by_name(parent_name="data").output_objects
vector_objects = node.arguments["mask"]
vector_object = node.arguments["mask"]

if not input_objects:
raise Exception("Process %s requires an input strds" % PROCESS_NAME)
Expand All @@ -212,7 +212,7 @@ def get_process_list(node: Node):
output_objects.append(output_object)

pc = create_process_chain_entry(
input_object, vector_object, inside, output_object)
input_object, vector_object, mask_value, inside, output_object)
process_list.extend(pc)

return output_objects, process_list
Expand Down
1 change: 1 addition & 0 deletions src/openeo_grass_gis_driver/jobs_job_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from openeo_grass_gis_driver.process_graph_db import GraphDB
from openeo_grass_gis_driver.job_db import JobDB
from openeo_grass_gis_driver.models.error_schemas import ErrorSchema
from openeo_grass_gis_driver.models.job_schemas import JobInformation
from openeo_grass_gis_driver.jobs import check_job
from openeo_grass_gis_driver.authentication import ResourceBase

Expand Down
4 changes: 4 additions & 0 deletions src/openeo_grass_gis_driver/models/service_schemas.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# -*- coding: utf-8 -*-
"""This file includes all required openEO response schemas
"""
import re
from datetime import datetime
from flask import make_response
from typing import Dict
from openeo_grass_gis_driver.models.schema_base import JsonableObject
from openeo_grass_gis_driver.models.process_graph_schemas import \
ProcessGraphNode
from openeo_grass_gis_driver.models.error_schemas import ErrorSchema

__author__ = "Anika Bettge"
__copyright__ = "Copyright 2018, mundialis"
Expand Down
40 changes: 0 additions & 40 deletions tests/test_process_graph_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,46 +74,6 @@ def test_6_graph_actiniamodule(self):
headers=self.auth)
self.assertEqual(response.status_code, 200)

def no_support_test_6_graph_zonal_statistics(self):
"""Run the validation test
"""
response = self.app.post(
'/validation',
data=json.dumps(ZONAL_STATISTICS),
content_type="application/json",
headers=self.auth)
self.assertEqual(response.status_code, 200)

def no_support_test_9_graph_raster_export(self):
"""Run the validation test
"""
response = self.app.post(
'/validation',
data=json.dumps(RASTER_EXPORT),
content_type="application/json",
headers=self.auth)
self.assertEqual(response.status_code, 200)

def no_support_test_10_graph_map_algebra(self):
"""Run the validation test
"""
response = self.app.post(
'/validation',
data=json.dumps(MAP_ALGEBRA),
content_type="application/json",
headers=self.auth)
self.assertEqual(response.status_code, 200)

def no_support_test_11_graph_temporal_algebra(self):
"""Run the validation test
"""
response = self.app.post(
'/validation',
data=json.dumps(TEMPORAL_ALGEBRA),
content_type="application/json",
headers=self.auth)
self.assertEqual(response.status_code, 200)


if __name__ == "__main__":
unittest.main()

0 comments on commit 02e896b

Please sign in to comment.