Skip to content
Snippets Groups Projects
Commit e7823a58 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

First commit

parent d2761ecc
No related branches found
No related tags found
No related merge requests found
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
[build-system]
requires = [
"setuptools>=42",
"wheel"
]
build-backend = "setuptools.build_meta"
\ No newline at end of file
[metadata]
name = vipscore-python-common
version = 0.5.0
author = Tor-Einar Skog
author_email = tor-einar.skog@nibio.no
description = Tools for the VIPSCore-Python web services and its models
long_description = file: README.md
long_description_content_type = text/markdown
url = https://www.vips-landbruk.no
classifiers =
Programming Language :: Python :: 3
License :: NIBIO Open Source License
Operating System :: OS Independent
[options]
package_dir =
= src
packages = find:
python_requires = >=3.6
[options.packages.find]
where = src
\ No newline at end of file
from .model import *
\ No newline at end of file
#!/usr/bin/python3
"""
Copyright (c) 2023 NIBIO <http://www.nibio.no/>.
This file is part of VIPSCore-Python-Common.
VIPSCore-Python-Common is free software: you can redistribute it and/or modify
it under the terms of the NIBIO Open Source License as published by
NIBIO, either version 1 of the License, or (at your option) any
later version.
VIPSCore-Python-Common is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
NIBIO Open Source License for more details.
You should have received a copy of the NIBIO Open Source License
along with VIPSCore-Python-Common. If not, see <http://www.nibio.no/licenses/>.
"""
# All models in VIPSCore-Python must extend this abstract class
# @author Tor-Einar Skog <tor-einar.skog@nibio.no>
from abc import ABC, abstractmethod
from typing import List, Dict
class Model(ABC):
# Default language is English
default_language = "en"
# Set the configuration object (with all its possible parameters)
# Must be done before you call get_result
@abstractmethod
def set_configuration(self, model_configuration):
"""
Set the configuration object (with all its possible parameters)
Must be done before you call get_result
"""
pass
@abstractmethod
def get_result(self) -> List[Result]:
"""Get the results as a list of Result objects (TODO ref)"""
pass
@abstractmethod
def get_model_id(self) -> str:
"""10-character ID of the model. Must be unique (at least in the current system)"""
pass
@abstractmethod
def get_model_name(self) -> str:
"""Returns the model name in the default language"""
pass
@abstractmethod
def get_model_name(self, language: str) -> str:
"""Returns the model name in the specified language (<a href="http://www.loc.gov/standards/iso639-2/php/English_list.php">ISO-639-2</a>)"""
pass
@abstractmethod
def get_license(self) -> str:
"""Returns the license for this piece of software"""
pass
@abstractmethod
def get_copyright(self) -> str:
"""Name of person/organization that holds the copyright, and contact information"""
pass
@abstractmethod
def get_model_description(self) -> str:
"""Description of model (In default_language). Should include interpretation of the red-yellow-green warning system"""
pass
@abstractmethod
def get_model_description(self, language: str) -> str:
"""Returns the model description in the specified language (<a href="http://www.loc.gov/standards/iso639-2/php/English_list.php">ISO-639-2</a>)"""
pass
@abstractmethod
def get_warning_status_interpretation(self) -> str:
"""How to interpret the warning status (red-yellow-green, what does it mean?) in the default language"""
pass
@abstractmethod
def get_warning_status_interpretation(self, language: str) -> str:
"""How to interpret the warning status (red-yellow-green, what does it mean?) in the specified language (<a href="http://www.loc.gov/standards/iso639-2/php/English_list.php">ISO-639-2</a>)"""
pass
@abstractmethod
def get_model_usage(self) -> str:
"""Technical manual for this model, in the default language"""
pass
@abstractmethod
def get_model_usage(self, language: str) -> str:
"""Technical manual for this model, in the specified language (<a href="http://www.loc.gov/standards/iso639-2/php/English_list.php">ISO-639-2</a>)"""
pass
@abstractmethod
def get_sample_config(self) -> Dict:
"""A sample configuration in JSON format (TODO check relation with Dict)"""
pass
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment