-
-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
abfbd26
commit e4a57bb
Showing
1 changed file
with
11 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
# ================================================================= | ||
# | ||
# Authors: Alexander Pilz <[email protected]> | ||
# Tom Kralidis <[email protected]> | ||
# | ||
# Copyright (c) 2023 Alexander Pilz | ||
# Copyright (c) 2023 Tom Kralidis | ||
# | ||
# Permission is hereby granted, free of charge, to any person | ||
# obtaining a copy of this software and associated documentation | ||
|
@@ -26,6 +28,7 @@ | |
# OTHER DEALINGS IN THE SOFTWARE. | ||
# | ||
# ================================================================= | ||
|
||
import logging | ||
import time | ||
|
||
|
@@ -99,15 +102,15 @@ | |
} | ||
|
||
|
||
class echoProcessor(BaseProcessor): | ||
class EchoProcessor(BaseProcessor): | ||
"""Echo Processor example""" | ||
def __init__(self, processor_def): | ||
""" | ||
Initialize object | ||
:param processor_def: provider definition | ||
:returns: pygeoapi.process.echo.echoProcessor | ||
:returns: pygeoapi.process.echo.EchoProcessor | ||
""" | ||
|
||
super().__init__(processor_def, PROCESS_METADATA) | ||
|
@@ -116,24 +119,26 @@ def execute(self, data): | |
|
||
mimetype = 'application/json' | ||
|
||
echo = data.get('echoInput', None) | ||
pause = data.get('pause', None) | ||
echo = data.get('echoInput') | ||
pause = data.get('pause') | ||
|
||
if echo is None: | ||
raise ProcessorExecuteError( | ||
'Cannot run process without echo value') | ||
|
||
if not isinstance(echo, str): | ||
raise ProcessorExecuteError( | ||
'Cannot run process with echo not of type String') | ||
'Cannot run process with echo not of type string') | ||
|
||
outputs = { | ||
'id': 'echoOutput', | ||
'value': echo | ||
} | ||
|
||
if pause is not None and isinstance(pause, float): | ||
time.sleep(pause) | ||
|
||
return mimetype, outputs | ||
|
||
def __repr__(self): | ||
return '<echoProcessor> {}'.format(self.name) | ||
return f'<EchoProcessor> {self.name}' |