Commit 4b5ac499 authored by Daniel Eggert's avatar Daniel Eggert
Browse files

prepared pypi publish

parent 72da5b8b
from progress_report import ProgressReport
from send_handler_interface import FormalProgressInterface
\ No newline at end of file
import abc
import json
from typing import List
def report_to_json(report: 'ProgressReport') -> dict:
return {
'step_message': report.step_message,
'steps': report.steps,
'completed': report.completed,
'children': [report_to_json(child) for child in report.children]
}
class FormalProgressInterface(metaclass=abc.ABCMeta):
def __init__(self):
self.__root_progress = None
def set_root_progress_report(self, progress_report_root: 'ProgressReport'):
self.__root_progress = progress_report_root
self.submit()
def has_root(self) -> bool:
return self.__root_progress is not None
def submit(self):
if self.__root_progress:
self.send(json.dumps(report_to_json(self.__root_progress)))
def get_data(self):
return report_to_json(self.__root_progress)
@abc.abstractmethod
def send(self, progress_json: str):
pass
from send_handler_interface import FormalProgressInterface
class ProgressReport:
def __init__(self, step_message: str, send_handler: FormalProgressInterface, steps: int = 0):
......
import abc
import json
from progress_report import ProgressReport
def report_to_json(report: 'ProgressReport') -> dict:
return {
'step_message': report.step_message,
'steps': report.steps,
'completed': report.completed,
'children': [report_to_json(child) for child in report.children]
}
class FormalProgressInterface(metaclass=abc.ABCMeta):
def __init__(self):
self.__root_progress = None
def set_root_progress_report(self, progress_report_root: ProgressReport):
self.__root_progress = progress_report_root
self.submit()
def has_root(self) -> bool:
return self.__root_progress is not None
def submit(self):
if self.__root_progress:
self.send(json.dumps(report_to_json(self.__root_progress)))
def get_data(self):
return report_to_json(self.__root_progress)
@abc.abstractmethod
def send(self, progress_json: str):
pass
[metadata]
description-file=README.md
\ No newline at end of file
......@@ -2,10 +2,12 @@ from setuptools import setup
setup(
name='deprogressapi',
packages=['deprogressapi'],
version='0.1.0',
description='basic back-end progress api for the data analytics software framework dasf',
license='Apache-2.0',
author='Daniel Eggert <daniel.eggert@gfz-potsdam.de>, Adam Sasin <sasin@hu-potsdam.de>',
author_email = 'daniel.eggert@gfz-potsdam.de',
keywords=['dasf', 'digital-earth', 'pulsar', 'gfz', 'progress reporting', 'api'],
url='https://git.geomar.de/digital-earth/dasf/dasf-progress-api',
install_requires=[
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment