Initial commit
This commit is contained in:
@@ -0,0 +1,72 @@
|
|||||||
|
.travis.yaml
|
||||||
|
.swagger-codegen-ignore
|
||||||
|
README.md
|
||||||
|
tox.ini
|
||||||
|
git_push.sh
|
||||||
|
test-requirements.txt
|
||||||
|
setup.py
|
||||||
|
|
||||||
|
# Byte-compiled / optimized / DLL files
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
|
# C extensions
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Distribution / packaging
|
||||||
|
.Python
|
||||||
|
env/
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
|
||||||
|
# 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/
|
||||||
|
.coverage
|
||||||
|
.coverage.*
|
||||||
|
.cache
|
||||||
|
nosetests.xml
|
||||||
|
coverage.xml
|
||||||
|
*,cover
|
||||||
|
.hypothesis/
|
||||||
|
venv/
|
||||||
|
.python-version
|
||||||
|
|
||||||
|
# Translations
|
||||||
|
*.mo
|
||||||
|
*.pot
|
||||||
|
|
||||||
|
# Django stuff:
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Sphinx documentation
|
||||||
|
docs/_build/
|
||||||
|
|
||||||
|
# PyBuilder
|
||||||
|
target/
|
||||||
|
|
||||||
|
#Ipython Notebook
|
||||||
|
.ipynb_checkpoints
|
||||||
+67
@@ -0,0 +1,67 @@
|
|||||||
|
# Byte-compiled / optimized / DLL files
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
|
# C extensions
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Distribution / packaging
|
||||||
|
.Python
|
||||||
|
env/
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
|
||||||
|
# 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/
|
||||||
|
.coverage
|
||||||
|
.coverage.*
|
||||||
|
.cache
|
||||||
|
nosetests.xml
|
||||||
|
coverage.xml
|
||||||
|
*,cover
|
||||||
|
.hypothesis/
|
||||||
|
venv/
|
||||||
|
.python-version
|
||||||
|
|
||||||
|
# Translations
|
||||||
|
*.mo
|
||||||
|
*.pot
|
||||||
|
|
||||||
|
# Django stuff:
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Sphinx documentation
|
||||||
|
docs/_build/
|
||||||
|
|
||||||
|
# PyBuilder
|
||||||
|
target/
|
||||||
|
|
||||||
|
#Ipython Notebook
|
||||||
|
.ipynb_checkpoints
|
||||||
|
|
||||||
|
# JetBrains
|
||||||
|
.idea
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Swagger Codegen Ignore
|
||||||
|
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
|
||||||
|
|
||||||
|
# Use this file to prevent files from being overwritten by the generator.
|
||||||
|
# The patterns follow closely to .gitignore or .dockerignore.
|
||||||
|
|
||||||
|
# As an example, the C# client generator defines ApiClient.cs.
|
||||||
|
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
|
||||||
|
#ApiClient.cs
|
||||||
|
|
||||||
|
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||||
|
#foo/*/qux
|
||||||
|
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||||
|
#foo/**/qux
|
||||||
|
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can also negate patterns with an exclamation (!).
|
||||||
|
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||||
|
#docs/*.md
|
||||||
|
# Then explicitly reverse the ignore rule for a single file:
|
||||||
|
#!docs/README.md
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
3.0.34
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
# ref: https://docs.travis-ci.com/user/languages/python
|
||||||
|
language: python
|
||||||
|
python:
|
||||||
|
- "3.2"
|
||||||
|
- "3.3"
|
||||||
|
- "3.4"
|
||||||
|
- "3.5"
|
||||||
|
#- "3.5-dev" # 3.5 development branch
|
||||||
|
#- "nightly" # points to the latest development branch e.g. 3.6-dev
|
||||||
|
# command to install dependencies
|
||||||
|
install: "pip install -r requirements.txt"
|
||||||
|
# command to run tests
|
||||||
|
script: nosetests
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
FROM python:3.6-alpine
|
||||||
|
|
||||||
|
RUN mkdir -p /usr/src/app
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
COPY requirements.txt /usr/src/app/
|
||||||
|
|
||||||
|
RUN pip3 install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
COPY . /usr/src/app
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
ENTRYPOINT ["python3"]
|
||||||
|
|
||||||
|
CMD ["-m", "swagger_server"]
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
# Swagger generated server
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the
|
||||||
|
[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
|
||||||
|
is an example of building a swagger-enabled Flask server.
|
||||||
|
|
||||||
|
This example uses the [Connexion](https://github.com/zalando/connexion) library on top of Flask.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
Python 3.5.2+
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
To run the server, please execute the following from the root directory:
|
||||||
|
|
||||||
|
```
|
||||||
|
pip3 install -r requirements.txt
|
||||||
|
python3 -m swagger_server
|
||||||
|
```
|
||||||
|
|
||||||
|
and open your browser to here:
|
||||||
|
|
||||||
|
```
|
||||||
|
http://localhost:8080/ui/
|
||||||
|
```
|
||||||
|
|
||||||
|
Your Swagger definition lives here:
|
||||||
|
|
||||||
|
```
|
||||||
|
http://localhost:8080/swagger.json
|
||||||
|
```
|
||||||
|
|
||||||
|
To launch the integration tests, use tox:
|
||||||
|
```
|
||||||
|
sudo pip install tox
|
||||||
|
tox
|
||||||
|
```
|
||||||
|
|
||||||
|
## Running with Docker
|
||||||
|
|
||||||
|
To run the server on a Docker container, please execute the following from the root directory:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# building the image
|
||||||
|
docker build -t swagger_server .
|
||||||
|
|
||||||
|
# starting up a container
|
||||||
|
docker run -p 8080:8080 swagger_server
|
||||||
|
```
|
||||||
+52
@@ -0,0 +1,52 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||||
|
#
|
||||||
|
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
|
||||||
|
|
||||||
|
git_user_id=$1
|
||||||
|
git_repo_id=$2
|
||||||
|
release_note=$3
|
||||||
|
|
||||||
|
if [ "$git_user_id" = "" ]; then
|
||||||
|
git_user_id="GIT_USER_ID"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$git_repo_id" = "" ]; then
|
||||||
|
git_repo_id="GIT_REPO_ID"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$release_note" = "" ]; then
|
||||||
|
release_note="Minor update"
|
||||||
|
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Initialize the local directory as a Git repository
|
||||||
|
git init
|
||||||
|
|
||||||
|
# Adds the files in the local repository and stages them for commit.
|
||||||
|
git add .
|
||||||
|
|
||||||
|
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||||
|
git commit -m "$release_note"
|
||||||
|
|
||||||
|
# Sets the new remote
|
||||||
|
git_remote=`git remote`
|
||||||
|
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||||
|
|
||||||
|
if [ "$GIT_TOKEN" = "" ]; then
|
||||||
|
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||||
|
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
||||||
|
else
|
||||||
|
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
git pull origin master
|
||||||
|
|
||||||
|
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||||
|
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
||||||
|
git push origin master 2>&1 | grep -v 'To https'
|
||||||
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
connexion >= 2.6.0
|
||||||
|
connexion[swagger-ui] >= 2.6.0
|
||||||
|
python_dateutil == 2.6.0
|
||||||
|
setuptools >= 21.0.0
|
||||||
|
swagger-ui-bundle >= 0.0.2
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
|
NAME = "swagger_server"
|
||||||
|
VERSION = "1.0.0"
|
||||||
|
# To install the library, run the following
|
||||||
|
#
|
||||||
|
# python setup.py install
|
||||||
|
#
|
||||||
|
# prerequisite: setuptools
|
||||||
|
# http://pypi.python.org/pypi/setuptools
|
||||||
|
|
||||||
|
REQUIRES = [
|
||||||
|
"connexion",
|
||||||
|
"swagger-ui-bundle>=0.0.2"
|
||||||
|
]
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name=NAME,
|
||||||
|
version=VERSION,
|
||||||
|
description="OpenAPI definition",
|
||||||
|
author_email="",
|
||||||
|
url="",
|
||||||
|
keywords=["Swagger", "OpenAPI definition"],
|
||||||
|
install_requires=REQUIRES,
|
||||||
|
packages=find_packages(),
|
||||||
|
package_data={'': ['swagger/swagger.yaml']},
|
||||||
|
include_package_data=True,
|
||||||
|
entry_points={
|
||||||
|
'console_scripts': ['swagger_server=swagger_server.__main__:main']},
|
||||||
|
long_description="""\
|
||||||
|
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
||||||
|
"""
|
||||||
|
)
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import connexion
|
||||||
|
|
||||||
|
from swagger_server import encoder
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
app = connexion.App(__name__, specification_dir='./swagger/')
|
||||||
|
app.app.json_encoder = encoder.JSONEncoder
|
||||||
|
app.add_api('swagger.yaml', arguments={'title': 'OpenAPI definition'}, pythonic_params=True)
|
||||||
|
app.run(port=8080)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
from typing import List
|
||||||
|
"""
|
||||||
|
controller generated to handled auth operation described at:
|
||||||
|
https://connexion.readthedocs.io/en/latest/security.html
|
||||||
|
"""
|
||||||
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import connexion
|
||||||
|
import six
|
||||||
|
|
||||||
|
from swagger_server import util
|
||||||
|
|
||||||
|
|
||||||
|
def datoteka_v_besedilo_post(file=None): # noqa: E501
|
||||||
|
"""Pretvori datoteko formata pdf, doc, docx, ppt, xls,... v besedilo
|
||||||
|
|
||||||
|
# noqa: E501
|
||||||
|
|
||||||
|
:param file:
|
||||||
|
:type file: strstr
|
||||||
|
|
||||||
|
:rtype: str
|
||||||
|
"""
|
||||||
|
return 'do some magic!'
|
||||||
|
|
||||||
|
|
||||||
|
def get_text_ocr(file=None): # noqa: E501
|
||||||
|
"""Pretvori datoteko formata pdf, doc, docx, ppt, xls,... v besedilo s pomočjo ocr razpoznavanja
|
||||||
|
|
||||||
|
# noqa: E501
|
||||||
|
|
||||||
|
:param file:
|
||||||
|
:type file: strstr
|
||||||
|
|
||||||
|
:rtype: str
|
||||||
|
"""
|
||||||
|
return 'do some magic!'
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import connexion
|
||||||
|
import six
|
||||||
|
|
||||||
|
from swagger_server.models.izlusci_body import IzlusciBody # noqa: E501
|
||||||
|
from swagger_server.models.terminoloski_kandidat import TerminoloskiKandidat # noqa: E501
|
||||||
|
from swagger_server import util
|
||||||
|
|
||||||
|
|
||||||
|
def get_candidates(body): # noqa: E501
|
||||||
|
"""Izlusci terminološke kandidate iz seznama besedil v conllu obliki
|
||||||
|
|
||||||
|
# noqa: E501
|
||||||
|
|
||||||
|
:param body:
|
||||||
|
:type body: dict | bytes
|
||||||
|
|
||||||
|
:rtype: List[TerminoloskiKandidat]
|
||||||
|
"""
|
||||||
|
if connexion.request.is_json:
|
||||||
|
body = IzlusciBody.from_dict(connexion.request.get_json()) # noqa: E501
|
||||||
|
return 'do some magic!'
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import connexion
|
||||||
|
import six
|
||||||
|
|
||||||
|
from swagger_server import util
|
||||||
|
|
||||||
|
|
||||||
|
def get_text(body): # noqa: E501
|
||||||
|
"""Označi besedilo s classlo/stanzo z uporabo slovenskih modelov ter vrne conll-u format
|
||||||
|
|
||||||
|
# noqa: E501
|
||||||
|
|
||||||
|
:param body:
|
||||||
|
:type body: dict | bytes
|
||||||
|
|
||||||
|
:rtype: str
|
||||||
|
"""
|
||||||
|
if connexion.request.is_json:
|
||||||
|
body = str.from_dict(connexion.request.get_json()) # noqa: E501
|
||||||
|
return 'do some magic!'
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
import connexion
|
||||||
|
import six
|
||||||
|
|
||||||
|
from swagger_server.models.terminoloski_kandidat import TerminoloskiKandidat # noqa: E501
|
||||||
|
from swagger_server import util
|
||||||
|
|
||||||
|
|
||||||
|
def get_conllu(id): # noqa: E501
|
||||||
|
"""Vrne CoNNL-U po id-ju datoteke
|
||||||
|
|
||||||
|
# noqa: E501
|
||||||
|
|
||||||
|
:param id:
|
||||||
|
:type id: int
|
||||||
|
|
||||||
|
:rtype: str
|
||||||
|
"""
|
||||||
|
return 'do some magic!'
|
||||||
|
|
||||||
|
|
||||||
|
def get_conllus(leta, vrste, kljucnebesede, cerifpodrocja): # noqa: E501
|
||||||
|
"""Vrne seznam CoNNL-U-jev glede na iskalne pogoje
|
||||||
|
|
||||||
|
# noqa: E501
|
||||||
|
|
||||||
|
:param leta:
|
||||||
|
:type leta: List[int]
|
||||||
|
:param vrste:
|
||||||
|
:type vrste: List[str]
|
||||||
|
:param kljucnebesede:
|
||||||
|
:type kljucnebesede: List[str]
|
||||||
|
:param cerifpodrocja:
|
||||||
|
:type cerifpodrocja: List[int]
|
||||||
|
|
||||||
|
:rtype: List[str]
|
||||||
|
"""
|
||||||
|
return 'do some magic!'
|
||||||
|
|
||||||
|
|
||||||
|
def get_extracted_words(leta, vrste, kljucnebesede, cerifpodrocja): # noqa: E501
|
||||||
|
"""Vrne terminloške kandidate glede na
|
||||||
|
|
||||||
|
# noqa: E501
|
||||||
|
|
||||||
|
:param leta:
|
||||||
|
:type leta: List[int]
|
||||||
|
:param vrste:
|
||||||
|
:type vrste: List[str]
|
||||||
|
:param kljucnebesede:
|
||||||
|
:type kljucnebesede: List[str]
|
||||||
|
:param cerifpodrocja:
|
||||||
|
:type cerifpodrocja: List[int]
|
||||||
|
|
||||||
|
:rtype: List[TerminoloskiKandidat]
|
||||||
|
"""
|
||||||
|
return 'do some magic!'
|
||||||
|
|
||||||
|
|
||||||
|
def get_file(id): # noqa: E501
|
||||||
|
"""Vrne binarni zapis v originalnem formatu po id-ju datoteke
|
||||||
|
|
||||||
|
# noqa: E501
|
||||||
|
|
||||||
|
:param id:
|
||||||
|
:type id: int
|
||||||
|
|
||||||
|
:rtype: List[bytearray]
|
||||||
|
"""
|
||||||
|
return 'do some magic!'
|
||||||
|
|
||||||
|
|
||||||
|
def get_files(leta, vrste, kljucnebesede, cerifpodrocja): # noqa: E501
|
||||||
|
"""Vrne seznam binarnih zapisov v originalnem formatu glede na iskalne pogoje
|
||||||
|
|
||||||
|
# noqa: E501
|
||||||
|
|
||||||
|
:param leta:
|
||||||
|
:type leta: List[int]
|
||||||
|
:param vrste:
|
||||||
|
:type vrste: List[str]
|
||||||
|
:param kljucnebesede:
|
||||||
|
:type kljucnebesede: List[str]
|
||||||
|
:param cerifpodrocja:
|
||||||
|
:type cerifpodrocja: List[int]
|
||||||
|
|
||||||
|
:rtype: List[List[bytearray]]
|
||||||
|
"""
|
||||||
|
return 'do some magic!'
|
||||||
|
|
||||||
|
|
||||||
|
def get_number_texts(leta, vrste, kljucnebesede, cerifpodrocja): # noqa: E501
|
||||||
|
"""Vrne število besedil glede na iskalne pogoje
|
||||||
|
|
||||||
|
# noqa: E501
|
||||||
|
|
||||||
|
:param leta:
|
||||||
|
:type leta: List[int]
|
||||||
|
:param vrste:
|
||||||
|
:type vrste: List[str]
|
||||||
|
:param kljucnebesede:
|
||||||
|
:type kljucnebesede: List[str]
|
||||||
|
:param cerifpodrocja:
|
||||||
|
:type cerifpodrocja: List[int]
|
||||||
|
|
||||||
|
:rtype: int
|
||||||
|
"""
|
||||||
|
return 'do some magic!'
|
||||||
|
|
||||||
|
|
||||||
|
def get_texts(leta, vrste, kljucnebesede, cerifpodrocja): # noqa: E501
|
||||||
|
"""Vrne seznam besedil glede na iskalne pogoje
|
||||||
|
|
||||||
|
# noqa: E501
|
||||||
|
|
||||||
|
:param leta:
|
||||||
|
:type leta: List[int]
|
||||||
|
:param vrste:
|
||||||
|
:type vrste: List[str]
|
||||||
|
:param kljucnebesede:
|
||||||
|
:type kljucnebesede: List[str]
|
||||||
|
:param cerifpodrocja:
|
||||||
|
:type cerifpodrocja: List[int]
|
||||||
|
|
||||||
|
:rtype: List[str]
|
||||||
|
"""
|
||||||
|
return 'do some magic!'
|
||||||
|
|
||||||
|
|
||||||
|
def oss_besedilo_po_id_get(id): # noqa: E501
|
||||||
|
"""Vrne besedilo po id-ju datoteke
|
||||||
|
|
||||||
|
# noqa: E501
|
||||||
|
|
||||||
|
:param id:
|
||||||
|
:type id: int
|
||||||
|
|
||||||
|
:rtype: str
|
||||||
|
"""
|
||||||
|
return 'do some magic!'
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
from connexion.apps.flask_app import FlaskJSONEncoder
|
||||||
|
import six
|
||||||
|
|
||||||
|
from swagger_server.models.base_model_ import Model
|
||||||
|
|
||||||
|
|
||||||
|
class JSONEncoder(FlaskJSONEncoder):
|
||||||
|
include_nulls = False
|
||||||
|
|
||||||
|
def default(self, o):
|
||||||
|
if isinstance(o, Model):
|
||||||
|
dikt = {}
|
||||||
|
for attr, _ in six.iteritems(o.swagger_types):
|
||||||
|
value = getattr(o, attr)
|
||||||
|
if value is None and not self.include_nulls:
|
||||||
|
continue
|
||||||
|
attr = o.attribute_map[attr]
|
||||||
|
dikt[attr] = value
|
||||||
|
return dikt
|
||||||
|
return FlaskJSONEncoder.default(self, o)
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
# flake8: noqa
|
||||||
|
from __future__ import absolute_import
|
||||||
|
# import models into model package
|
||||||
|
from swagger_server.models.datoteka_v_besedilo_body import DatotekaVBesediloBody
|
||||||
|
from swagger_server.models.datoteka_v_besedilo_ocr_body import DatotekaVBesediloOcrBody
|
||||||
|
from swagger_server.models.izlusci_body import IzlusciBody
|
||||||
|
from swagger_server.models.terminoloski_kandidat import TerminoloskiKandidat
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
import pprint
|
||||||
|
|
||||||
|
import six
|
||||||
|
import typing
|
||||||
|
|
||||||
|
from swagger_server import util
|
||||||
|
|
||||||
|
T = typing.TypeVar('T')
|
||||||
|
|
||||||
|
|
||||||
|
class Model(object):
|
||||||
|
# swaggerTypes: The key is attribute name and the
|
||||||
|
# value is attribute type.
|
||||||
|
swagger_types = {}
|
||||||
|
|
||||||
|
# attributeMap: The key is attribute name and the
|
||||||
|
# value is json key in definition.
|
||||||
|
attribute_map = {}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: typing.Type[T], dikt) -> T:
|
||||||
|
"""Returns the dict as a model"""
|
||||||
|
return util.deserialize_model(dikt, cls)
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
"""Returns the model properties as a dict
|
||||||
|
|
||||||
|
:rtype: dict
|
||||||
|
"""
|
||||||
|
result = {}
|
||||||
|
|
||||||
|
for attr, _ in six.iteritems(self.swagger_types):
|
||||||
|
value = getattr(self, attr)
|
||||||
|
if isinstance(value, list):
|
||||||
|
result[attr] = list(map(
|
||||||
|
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
|
||||||
|
value
|
||||||
|
))
|
||||||
|
elif hasattr(value, "to_dict"):
|
||||||
|
result[attr] = value.to_dict()
|
||||||
|
elif isinstance(value, dict):
|
||||||
|
result[attr] = dict(map(
|
||||||
|
lambda item: (item[0], item[1].to_dict())
|
||||||
|
if hasattr(item[1], "to_dict") else item,
|
||||||
|
value.items()
|
||||||
|
))
|
||||||
|
else:
|
||||||
|
result[attr] = value
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
def to_str(self):
|
||||||
|
"""Returns the string representation of the model
|
||||||
|
|
||||||
|
:rtype: str
|
||||||
|
"""
|
||||||
|
return pprint.pformat(self.to_dict())
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
"""For `print` and `pprint`"""
|
||||||
|
return self.to_str()
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
"""Returns true if both objects are equal"""
|
||||||
|
return self.__dict__ == other.__dict__
|
||||||
|
|
||||||
|
def __ne__(self, other):
|
||||||
|
"""Returns true if both objects are not equal"""
|
||||||
|
return not self == other
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
|
from datetime import date, datetime # noqa: F401
|
||||||
|
|
||||||
|
from typing import List, Dict # noqa: F401
|
||||||
|
|
||||||
|
from swagger_server.models.base_model_ import Model
|
||||||
|
from swagger_server import util
|
||||||
|
|
||||||
|
|
||||||
|
class DatotekaVBesediloBody(Model):
|
||||||
|
"""NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
"""
|
||||||
|
def __init__(self, file: str=None): # noqa: E501
|
||||||
|
"""DatotekaVBesediloBody - a model defined in Swagger
|
||||||
|
|
||||||
|
:param file: The file of this DatotekaVBesediloBody. # noqa: E501
|
||||||
|
:type file: str
|
||||||
|
"""
|
||||||
|
self.swagger_types = {
|
||||||
|
'file': str
|
||||||
|
}
|
||||||
|
|
||||||
|
self.attribute_map = {
|
||||||
|
'file': 'file'
|
||||||
|
}
|
||||||
|
self._file = file
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, dikt) -> 'DatotekaVBesediloBody':
|
||||||
|
"""Returns the dict as a model
|
||||||
|
|
||||||
|
:param dikt: A dict.
|
||||||
|
:type: dict
|
||||||
|
:return: The datotekaVBesedilo_body of this DatotekaVBesediloBody. # noqa: E501
|
||||||
|
:rtype: DatotekaVBesediloBody
|
||||||
|
"""
|
||||||
|
return util.deserialize_model(dikt, cls)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def file(self) -> str:
|
||||||
|
"""Gets the file of this DatotekaVBesediloBody.
|
||||||
|
|
||||||
|
|
||||||
|
:return: The file of this DatotekaVBesediloBody.
|
||||||
|
:rtype: str
|
||||||
|
"""
|
||||||
|
return self._file
|
||||||
|
|
||||||
|
@file.setter
|
||||||
|
def file(self, file: str):
|
||||||
|
"""Sets the file of this DatotekaVBesediloBody.
|
||||||
|
|
||||||
|
|
||||||
|
:param file: The file of this DatotekaVBesediloBody.
|
||||||
|
:type file: str
|
||||||
|
"""
|
||||||
|
if file is None:
|
||||||
|
raise ValueError("Invalid value for `file`, must not be `None`") # noqa: E501
|
||||||
|
|
||||||
|
self._file = file
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
|
from datetime import date, datetime # noqa: F401
|
||||||
|
|
||||||
|
from typing import List, Dict # noqa: F401
|
||||||
|
|
||||||
|
from swagger_server.models.base_model_ import Model
|
||||||
|
from swagger_server import util
|
||||||
|
|
||||||
|
|
||||||
|
class DatotekaVBesediloOcrBody(Model):
|
||||||
|
"""NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
"""
|
||||||
|
def __init__(self, file: str=None): # noqa: E501
|
||||||
|
"""DatotekaVBesediloOcrBody - a model defined in Swagger
|
||||||
|
|
||||||
|
:param file: The file of this DatotekaVBesediloOcrBody. # noqa: E501
|
||||||
|
:type file: str
|
||||||
|
"""
|
||||||
|
self.swagger_types = {
|
||||||
|
'file': str
|
||||||
|
}
|
||||||
|
|
||||||
|
self.attribute_map = {
|
||||||
|
'file': 'file'
|
||||||
|
}
|
||||||
|
self._file = file
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, dikt) -> 'DatotekaVBesediloOcrBody':
|
||||||
|
"""Returns the dict as a model
|
||||||
|
|
||||||
|
:param dikt: A dict.
|
||||||
|
:type: dict
|
||||||
|
:return: The datotekaVBesedilo_ocr_body of this DatotekaVBesediloOcrBody. # noqa: E501
|
||||||
|
:rtype: DatotekaVBesediloOcrBody
|
||||||
|
"""
|
||||||
|
return util.deserialize_model(dikt, cls)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def file(self) -> str:
|
||||||
|
"""Gets the file of this DatotekaVBesediloOcrBody.
|
||||||
|
|
||||||
|
|
||||||
|
:return: The file of this DatotekaVBesediloOcrBody.
|
||||||
|
:rtype: str
|
||||||
|
"""
|
||||||
|
return self._file
|
||||||
|
|
||||||
|
@file.setter
|
||||||
|
def file(self, file: str):
|
||||||
|
"""Sets the file of this DatotekaVBesediloOcrBody.
|
||||||
|
|
||||||
|
|
||||||
|
:param file: The file of this DatotekaVBesediloOcrBody.
|
||||||
|
:type file: str
|
||||||
|
"""
|
||||||
|
if file is None:
|
||||||
|
raise ValueError("Invalid value for `file`, must not be `None`") # noqa: E501
|
||||||
|
|
||||||
|
self._file = file
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
|
from datetime import date, datetime # noqa: F401
|
||||||
|
|
||||||
|
from typing import List, Dict # noqa: F401
|
||||||
|
|
||||||
|
from swagger_server.models.base_model_ import Model
|
||||||
|
from swagger_server import util
|
||||||
|
|
||||||
|
|
||||||
|
class IzlusciBody(Model):
|
||||||
|
"""NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
"""
|
||||||
|
def __init__(self, conllus: List[str]=None, prepovedane_besede: List[str]=None): # noqa: E501
|
||||||
|
"""IzlusciBody - a model defined in Swagger
|
||||||
|
|
||||||
|
:param conllus: The conllus of this IzlusciBody. # noqa: E501
|
||||||
|
:type conllus: List[str]
|
||||||
|
:param prepovedane_besede: The prepovedane_besede of this IzlusciBody. # noqa: E501
|
||||||
|
:type prepovedane_besede: List[str]
|
||||||
|
"""
|
||||||
|
self.swagger_types = {
|
||||||
|
'conllus': List[str],
|
||||||
|
'prepovedane_besede': List[str]
|
||||||
|
}
|
||||||
|
|
||||||
|
self.attribute_map = {
|
||||||
|
'conllus': 'conllus',
|
||||||
|
'prepovedane_besede': 'prepovedaneBesede'
|
||||||
|
}
|
||||||
|
self._conllus = conllus
|
||||||
|
self._prepovedane_besede = prepovedane_besede
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, dikt) -> 'IzlusciBody':
|
||||||
|
"""Returns the dict as a model
|
||||||
|
|
||||||
|
:param dikt: A dict.
|
||||||
|
:type: dict
|
||||||
|
:return: The izlusci_body of this IzlusciBody. # noqa: E501
|
||||||
|
:rtype: IzlusciBody
|
||||||
|
"""
|
||||||
|
return util.deserialize_model(dikt, cls)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def conllus(self) -> List[str]:
|
||||||
|
"""Gets the conllus of this IzlusciBody.
|
||||||
|
|
||||||
|
|
||||||
|
:return: The conllus of this IzlusciBody.
|
||||||
|
:rtype: List[str]
|
||||||
|
"""
|
||||||
|
return self._conllus
|
||||||
|
|
||||||
|
@conllus.setter
|
||||||
|
def conllus(self, conllus: List[str]):
|
||||||
|
"""Sets the conllus of this IzlusciBody.
|
||||||
|
|
||||||
|
|
||||||
|
:param conllus: The conllus of this IzlusciBody.
|
||||||
|
:type conllus: List[str]
|
||||||
|
"""
|
||||||
|
|
||||||
|
self._conllus = conllus
|
||||||
|
|
||||||
|
@property
|
||||||
|
def prepovedane_besede(self) -> List[str]:
|
||||||
|
"""Gets the prepovedane_besede of this IzlusciBody.
|
||||||
|
|
||||||
|
|
||||||
|
:return: The prepovedane_besede of this IzlusciBody.
|
||||||
|
:rtype: List[str]
|
||||||
|
"""
|
||||||
|
return self._prepovedane_besede
|
||||||
|
|
||||||
|
@prepovedane_besede.setter
|
||||||
|
def prepovedane_besede(self, prepovedane_besede: List[str]):
|
||||||
|
"""Sets the prepovedane_besede of this IzlusciBody.
|
||||||
|
|
||||||
|
|
||||||
|
:param prepovedane_besede: The prepovedane_besede of this IzlusciBody.
|
||||||
|
:type prepovedane_besede: List[str]
|
||||||
|
"""
|
||||||
|
|
||||||
|
self._prepovedane_besede = prepovedane_besede
|
||||||
@@ -0,0 +1,192 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
|
from datetime import date, datetime # noqa: F401
|
||||||
|
|
||||||
|
from typing import List, Dict # noqa: F401
|
||||||
|
|
||||||
|
from swagger_server.models.base_model_ import Model
|
||||||
|
from swagger_server import util
|
||||||
|
|
||||||
|
|
||||||
|
class TerminoloskiKandidat(Model):
|
||||||
|
"""NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
"""
|
||||||
|
def __init__(self, kandidat: str=None, kanonicnaoblika: str=None, po_soznake: str=None, nosilnautez: float=None, podporneutezi: List[float]=None, pogostostpojavljanja: List[int]=None): # noqa: E501
|
||||||
|
"""TerminoloskiKandidat - a model defined in Swagger
|
||||||
|
|
||||||
|
:param kandidat: The kandidat of this TerminoloskiKandidat. # noqa: E501
|
||||||
|
:type kandidat: str
|
||||||
|
:param kanonicnaoblika: The kanonicnaoblika of this TerminoloskiKandidat. # noqa: E501
|
||||||
|
:type kanonicnaoblika: str
|
||||||
|
:param po_soznake: The po_soznake of this TerminoloskiKandidat. # noqa: E501
|
||||||
|
:type po_soznake: str
|
||||||
|
:param nosilnautez: The nosilnautez of this TerminoloskiKandidat. # noqa: E501
|
||||||
|
:type nosilnautez: float
|
||||||
|
:param podporneutezi: The podporneutezi of this TerminoloskiKandidat. # noqa: E501
|
||||||
|
:type podporneutezi: List[float]
|
||||||
|
:param pogostostpojavljanja: The pogostostpojavljanja of this TerminoloskiKandidat. # noqa: E501
|
||||||
|
:type pogostostpojavljanja: List[int]
|
||||||
|
"""
|
||||||
|
self.swagger_types = {
|
||||||
|
'kandidat': str,
|
||||||
|
'kanonicnaoblika': str,
|
||||||
|
'po_soznake': str,
|
||||||
|
'nosilnautez': float,
|
||||||
|
'podporneutezi': List[float],
|
||||||
|
'pogostostpojavljanja': List[int]
|
||||||
|
}
|
||||||
|
|
||||||
|
self.attribute_map = {
|
||||||
|
'kandidat': 'kandidat',
|
||||||
|
'kanonicnaoblika': 'kanonicnaoblika',
|
||||||
|
'po_soznake': 'POSoznake',
|
||||||
|
'nosilnautez': 'nosilnautez',
|
||||||
|
'podporneutezi': 'podporneutezi',
|
||||||
|
'pogostostpojavljanja': 'pogostostpojavljanja'
|
||||||
|
}
|
||||||
|
self._kandidat = kandidat
|
||||||
|
self._kanonicnaoblika = kanonicnaoblika
|
||||||
|
self._po_soznake = po_soznake
|
||||||
|
self._nosilnautez = nosilnautez
|
||||||
|
self._podporneutezi = podporneutezi
|
||||||
|
self._pogostostpojavljanja = pogostostpojavljanja
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, dikt) -> 'TerminoloskiKandidat':
|
||||||
|
"""Returns the dict as a model
|
||||||
|
|
||||||
|
:param dikt: A dict.
|
||||||
|
:type: dict
|
||||||
|
:return: The TerminoloskiKandidat of this TerminoloskiKandidat. # noqa: E501
|
||||||
|
:rtype: TerminoloskiKandidat
|
||||||
|
"""
|
||||||
|
return util.deserialize_model(dikt, cls)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def kandidat(self) -> str:
|
||||||
|
"""Gets the kandidat of this TerminoloskiKandidat.
|
||||||
|
|
||||||
|
|
||||||
|
:return: The kandidat of this TerminoloskiKandidat.
|
||||||
|
:rtype: str
|
||||||
|
"""
|
||||||
|
return self._kandidat
|
||||||
|
|
||||||
|
@kandidat.setter
|
||||||
|
def kandidat(self, kandidat: str):
|
||||||
|
"""Sets the kandidat of this TerminoloskiKandidat.
|
||||||
|
|
||||||
|
|
||||||
|
:param kandidat: The kandidat of this TerminoloskiKandidat.
|
||||||
|
:type kandidat: str
|
||||||
|
"""
|
||||||
|
|
||||||
|
self._kandidat = kandidat
|
||||||
|
|
||||||
|
@property
|
||||||
|
def kanonicnaoblika(self) -> str:
|
||||||
|
"""Gets the kanonicnaoblika of this TerminoloskiKandidat.
|
||||||
|
|
||||||
|
|
||||||
|
:return: The kanonicnaoblika of this TerminoloskiKandidat.
|
||||||
|
:rtype: str
|
||||||
|
"""
|
||||||
|
return self._kanonicnaoblika
|
||||||
|
|
||||||
|
@kanonicnaoblika.setter
|
||||||
|
def kanonicnaoblika(self, kanonicnaoblika: str):
|
||||||
|
"""Sets the kanonicnaoblika of this TerminoloskiKandidat.
|
||||||
|
|
||||||
|
|
||||||
|
:param kanonicnaoblika: The kanonicnaoblika of this TerminoloskiKandidat.
|
||||||
|
:type kanonicnaoblika: str
|
||||||
|
"""
|
||||||
|
|
||||||
|
self._kanonicnaoblika = kanonicnaoblika
|
||||||
|
|
||||||
|
@property
|
||||||
|
def po_soznake(self) -> str:
|
||||||
|
"""Gets the po_soznake of this TerminoloskiKandidat.
|
||||||
|
|
||||||
|
|
||||||
|
:return: The po_soznake of this TerminoloskiKandidat.
|
||||||
|
:rtype: str
|
||||||
|
"""
|
||||||
|
return self._po_soznake
|
||||||
|
|
||||||
|
@po_soznake.setter
|
||||||
|
def po_soznake(self, po_soznake: str):
|
||||||
|
"""Sets the po_soznake of this TerminoloskiKandidat.
|
||||||
|
|
||||||
|
|
||||||
|
:param po_soznake: The po_soznake of this TerminoloskiKandidat.
|
||||||
|
:type po_soznake: str
|
||||||
|
"""
|
||||||
|
|
||||||
|
self._po_soznake = po_soznake
|
||||||
|
|
||||||
|
@property
|
||||||
|
def nosilnautez(self) -> float:
|
||||||
|
"""Gets the nosilnautez of this TerminoloskiKandidat.
|
||||||
|
|
||||||
|
|
||||||
|
:return: The nosilnautez of this TerminoloskiKandidat.
|
||||||
|
:rtype: float
|
||||||
|
"""
|
||||||
|
return self._nosilnautez
|
||||||
|
|
||||||
|
@nosilnautez.setter
|
||||||
|
def nosilnautez(self, nosilnautez: float):
|
||||||
|
"""Sets the nosilnautez of this TerminoloskiKandidat.
|
||||||
|
|
||||||
|
|
||||||
|
:param nosilnautez: The nosilnautez of this TerminoloskiKandidat.
|
||||||
|
:type nosilnautez: float
|
||||||
|
"""
|
||||||
|
|
||||||
|
self._nosilnautez = nosilnautez
|
||||||
|
|
||||||
|
@property
|
||||||
|
def podporneutezi(self) -> List[float]:
|
||||||
|
"""Gets the podporneutezi of this TerminoloskiKandidat.
|
||||||
|
|
||||||
|
|
||||||
|
:return: The podporneutezi of this TerminoloskiKandidat.
|
||||||
|
:rtype: List[float]
|
||||||
|
"""
|
||||||
|
return self._podporneutezi
|
||||||
|
|
||||||
|
@podporneutezi.setter
|
||||||
|
def podporneutezi(self, podporneutezi: List[float]):
|
||||||
|
"""Sets the podporneutezi of this TerminoloskiKandidat.
|
||||||
|
|
||||||
|
|
||||||
|
:param podporneutezi: The podporneutezi of this TerminoloskiKandidat.
|
||||||
|
:type podporneutezi: List[float]
|
||||||
|
"""
|
||||||
|
|
||||||
|
self._podporneutezi = podporneutezi
|
||||||
|
|
||||||
|
@property
|
||||||
|
def pogostostpojavljanja(self) -> List[int]:
|
||||||
|
"""Gets the pogostostpojavljanja of this TerminoloskiKandidat.
|
||||||
|
|
||||||
|
|
||||||
|
:return: The pogostostpojavljanja of this TerminoloskiKandidat.
|
||||||
|
:rtype: List[int]
|
||||||
|
"""
|
||||||
|
return self._pogostostpojavljanja
|
||||||
|
|
||||||
|
@pogostostpojavljanja.setter
|
||||||
|
def pogostostpojavljanja(self, pogostostpojavljanja: List[int]):
|
||||||
|
"""Sets the pogostostpojavljanja of this TerminoloskiKandidat.
|
||||||
|
|
||||||
|
|
||||||
|
:param pogostostpojavljanja: The pogostostpojavljanja of this TerminoloskiKandidat.
|
||||||
|
:type pogostostpojavljanja: List[int]
|
||||||
|
"""
|
||||||
|
|
||||||
|
self._pogostostpojavljanja = pogostostpojavljanja
|
||||||
@@ -0,0 +1,515 @@
|
|||||||
|
openapi: 3.0.1
|
||||||
|
info:
|
||||||
|
title: OpenAPI definition
|
||||||
|
version: v0
|
||||||
|
servers:
|
||||||
|
- url: http://localhost:8089
|
||||||
|
description: Generated server url
|
||||||
|
paths:
|
||||||
|
/oznaciBesedilo:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- marktext
|
||||||
|
summary: Označi besedilo s classlo/stanzo z uporabo slovenskih modelov ter vrne
|
||||||
|
conll-u format
|
||||||
|
operationId: get_text
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
content:
|
||||||
|
'*/*':
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
x-content-type: '*/*'
|
||||||
|
x-openapi-router-controller: swagger_server.controllers.marktext_controller
|
||||||
|
/izlusci:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- extract
|
||||||
|
summary: Izlusci terminološke kandidate iz seznama besedil v conllu obliki
|
||||||
|
operationId: get_candidates
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/izlusci_body'
|
||||||
|
required: true
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
content:
|
||||||
|
'*/*':
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/TerminoloskiKandidat'
|
||||||
|
x-content-type: '*/*'
|
||||||
|
x-openapi-router-controller: swagger_server.controllers.extract_controller
|
||||||
|
/datotekaVBesedilo/ocr:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- doc-2text
|
||||||
|
summary: "Pretvori datoteko formata pdf, doc, docx, ppt, xls,... v besedilo\
|
||||||
|
\ s pomočjo ocr razpoznavanja"
|
||||||
|
operationId: get_text_ocr
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
multipart/form-data:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/datotekaVBesedilo_ocr_body'
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
content:
|
||||||
|
'*/*':
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
x-content-type: '*/*'
|
||||||
|
x-openapi-router-controller: swagger_server.controllers.doc2text_controller
|
||||||
|
/datotekaVBesedilo/:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- doc-2text
|
||||||
|
summary: "Pretvori datoteko formata pdf, doc, docx, ppt, xls,... v besedilo"
|
||||||
|
operationId: datoteka_v_besedilo_post
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
multipart/form-data:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/datotekaVBesedilo_body'
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
content:
|
||||||
|
'*/*':
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
x-content-type: '*/*'
|
||||||
|
x-openapi-router-controller: swagger_server.controllers.doc2text_controller
|
||||||
|
/oss/steviloBesedilPoIskanju:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- oss
|
||||||
|
summary: Vrne število besedil glede na iskalne pogoje
|
||||||
|
operationId: get_number_texts
|
||||||
|
parameters:
|
||||||
|
- name: leta
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: true
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
- name: vrste
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: true
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
- name: kljucnebesede
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: true
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
- name: cerifpodrocja
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: true
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
content:
|
||||||
|
'*/*':
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
x-content-type: '*/*'
|
||||||
|
x-openapi-router-controller: swagger_server.controllers.oss_controller
|
||||||
|
/oss/izlusciPoIskanju:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- oss
|
||||||
|
summary: 'Vrne terminloške kandidate glede na '
|
||||||
|
operationId: get_extracted_words
|
||||||
|
parameters:
|
||||||
|
- name: leta
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: true
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
- name: vrste
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: true
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
- name: kljucnebesede
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: true
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
- name: cerifpodrocja
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: true
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
content:
|
||||||
|
'*/*':
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/TerminoloskiKandidat'
|
||||||
|
x-content-type: '*/*'
|
||||||
|
x-openapi-router-controller: swagger_server.controllers.oss_controller
|
||||||
|
/oss/datotekePoIskanju:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- oss
|
||||||
|
summary: Vrne seznam binarnih zapisov v originalnem formatu glede na iskalne
|
||||||
|
pogoje
|
||||||
|
operationId: get_files
|
||||||
|
parameters:
|
||||||
|
- name: leta
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: true
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
- name: vrste
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: true
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
- name: kljucnebesede
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: true
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
- name: cerifpodrocja
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: true
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
content:
|
||||||
|
application/octet-stream:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
format: byte
|
||||||
|
x-content-type: application/octet-stream
|
||||||
|
x-openapi-router-controller: swagger_server.controllers.oss_controller
|
||||||
|
/oss/datotekaPoId:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- oss
|
||||||
|
summary: Vrne binarni zapis v originalnem formatu po id-ju datoteke
|
||||||
|
operationId: get_file
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
content:
|
||||||
|
application/octet-stream:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
format: byte
|
||||||
|
x-content-type: application/octet-stream
|
||||||
|
x-openapi-router-controller: swagger_server.controllers.oss_controller
|
||||||
|
/oss/conlluPoIskanju:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- oss
|
||||||
|
summary: Vrne seznam CoNNL-U-jev glede na iskalne pogoje
|
||||||
|
operationId: get_conllus
|
||||||
|
parameters:
|
||||||
|
- name: leta
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: true
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
- name: vrste
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: true
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
- name: kljucnebesede
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: true
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
- name: cerifpodrocja
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: true
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
content:
|
||||||
|
'*/*':
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
x-content-type: '*/*'
|
||||||
|
x-openapi-router-controller: swagger_server.controllers.oss_controller
|
||||||
|
/oss/conlluPoId:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- oss
|
||||||
|
summary: Vrne CoNNL-U po id-ju datoteke
|
||||||
|
operationId: get_conllu
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
content:
|
||||||
|
'*/*':
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
x-content-type: '*/*'
|
||||||
|
x-openapi-router-controller: swagger_server.controllers.oss_controller
|
||||||
|
/oss/besediloPoId:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- oss
|
||||||
|
summary: Vrne besedilo po id-ju datoteke
|
||||||
|
operationId: oss_besedilo_po_id_get
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
content:
|
||||||
|
'*/*':
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
x-content-type: '*/*'
|
||||||
|
x-openapi-router-controller: swagger_server.controllers.oss_controller
|
||||||
|
/oss/besedilaPoIskanju:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- oss
|
||||||
|
summary: Vrne seznam besedil glede na iskalne pogoje
|
||||||
|
operationId: get_texts
|
||||||
|
parameters:
|
||||||
|
- name: leta
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: true
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
- name: vrste
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: true
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
- name: kljucnebesede
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: true
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
- name: cerifpodrocja
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
style: form
|
||||||
|
explode: true
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
content:
|
||||||
|
'*/*':
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
x-content-type: '*/*'
|
||||||
|
x-openapi-router-controller: swagger_server.controllers.oss_controller
|
||||||
|
components:
|
||||||
|
schemas:
|
||||||
|
TerminoloskiKandidat:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
kandidat:
|
||||||
|
type: string
|
||||||
|
kanonicnaoblika:
|
||||||
|
type: string
|
||||||
|
POSoznake:
|
||||||
|
type: string
|
||||||
|
nosilnautez:
|
||||||
|
type: number
|
||||||
|
format: float
|
||||||
|
podporneutezi:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: number
|
||||||
|
format: float
|
||||||
|
pogostostpojavljanja:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
example:
|
||||||
|
podporneutezi:
|
||||||
|
- 6.0274563
|
||||||
|
- 6.0274563
|
||||||
|
pogostostpojavljanja:
|
||||||
|
- 1
|
||||||
|
- 1
|
||||||
|
POSoznake: POSoznake
|
||||||
|
kanonicnaoblika: kanonicnaoblika
|
||||||
|
nosilnautez: 0.8008282
|
||||||
|
kandidat: kandidat
|
||||||
|
izlusci_body:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
conllus:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
prepovedaneBesede:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
datotekaVBesedilo_ocr_body:
|
||||||
|
required:
|
||||||
|
- file
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
file:
|
||||||
|
type: string
|
||||||
|
format: binary
|
||||||
|
datotekaVBesedilo_body:
|
||||||
|
required:
|
||||||
|
- file
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
file:
|
||||||
|
type: string
|
||||||
|
format: binary
|
||||||
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import logging
|
||||||
|
|
||||||
|
import connexion
|
||||||
|
from flask_testing import TestCase
|
||||||
|
|
||||||
|
from swagger_server.encoder import JSONEncoder
|
||||||
|
|
||||||
|
|
||||||
|
class BaseTestCase(TestCase):
|
||||||
|
|
||||||
|
def create_app(self):
|
||||||
|
logging.getLogger('connexion.operation').setLevel('ERROR')
|
||||||
|
app = connexion.App(__name__, specification_dir='../swagger/')
|
||||||
|
app.app.json_encoder = JSONEncoder
|
||||||
|
app.add_api('swagger.yaml')
|
||||||
|
return app.app
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
|
|
||||||
|
from flask import json
|
||||||
|
from six import BytesIO
|
||||||
|
|
||||||
|
from swagger_server.test import BaseTestCase
|
||||||
|
|
||||||
|
|
||||||
|
class TestDoc2textController(BaseTestCase):
|
||||||
|
"""Doc2textController integration test stubs"""
|
||||||
|
|
||||||
|
def test_datoteka_v_besedilo_post(self):
|
||||||
|
"""Test case for datoteka_v_besedilo_post
|
||||||
|
|
||||||
|
Pretvori datoteko formata pdf, doc, docx, ppt, xls,... v besedilo
|
||||||
|
"""
|
||||||
|
data = dict(file='file_example')
|
||||||
|
response = self.client.open(
|
||||||
|
'/datotekaVBesedilo/',
|
||||||
|
method='POST',
|
||||||
|
data=data,
|
||||||
|
content_type='multipart/form-data')
|
||||||
|
self.assert200(response,
|
||||||
|
'Response body is : ' + response.data.decode('utf-8'))
|
||||||
|
|
||||||
|
def test_get_text_ocr(self):
|
||||||
|
"""Test case for get_text_ocr
|
||||||
|
|
||||||
|
Pretvori datoteko formata pdf, doc, docx, ppt, xls,... v besedilo s pomočjo ocr razpoznavanja
|
||||||
|
"""
|
||||||
|
data = dict(file='file_example')
|
||||||
|
response = self.client.open(
|
||||||
|
'/datotekaVBesedilo/ocr',
|
||||||
|
method='POST',
|
||||||
|
data=data,
|
||||||
|
content_type='multipart/form-data')
|
||||||
|
self.assert200(response,
|
||||||
|
'Response body is : ' + response.data.decode('utf-8'))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import unittest
|
||||||
|
unittest.main()
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
|
|
||||||
|
from flask import json
|
||||||
|
from six import BytesIO
|
||||||
|
|
||||||
|
from swagger_server.models.izlusci_body import IzlusciBody # noqa: E501
|
||||||
|
from swagger_server.models.terminoloski_kandidat import TerminoloskiKandidat # noqa: E501
|
||||||
|
from swagger_server.test import BaseTestCase
|
||||||
|
|
||||||
|
|
||||||
|
class TestExtractController(BaseTestCase):
|
||||||
|
"""ExtractController integration test stubs"""
|
||||||
|
|
||||||
|
def test_get_candidates(self):
|
||||||
|
"""Test case for get_candidates
|
||||||
|
|
||||||
|
Izlusci terminološke kandidate iz seznama besedil v conllu obliki
|
||||||
|
"""
|
||||||
|
body = IzlusciBody()
|
||||||
|
response = self.client.open(
|
||||||
|
'/izlusci',
|
||||||
|
method='POST',
|
||||||
|
data=json.dumps(body),
|
||||||
|
content_type='application/json')
|
||||||
|
self.assert200(response,
|
||||||
|
'Response body is : ' + response.data.decode('utf-8'))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import unittest
|
||||||
|
unittest.main()
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
|
|
||||||
|
from flask import json
|
||||||
|
from six import BytesIO
|
||||||
|
|
||||||
|
from swagger_server.test import BaseTestCase
|
||||||
|
|
||||||
|
|
||||||
|
class TestMarktextController(BaseTestCase):
|
||||||
|
"""MarktextController integration test stubs"""
|
||||||
|
|
||||||
|
def test_get_text(self):
|
||||||
|
"""Test case for get_text
|
||||||
|
|
||||||
|
Označi besedilo s classlo/stanzo z uporabo slovenskih modelov ter vrne conll-u format
|
||||||
|
"""
|
||||||
|
body = 'body_example'
|
||||||
|
response = self.client.open(
|
||||||
|
'/oznaciBesedilo',
|
||||||
|
method='POST',
|
||||||
|
data=json.dumps(body),
|
||||||
|
content_type='application/json')
|
||||||
|
self.assert200(response,
|
||||||
|
'Response body is : ' + response.data.decode('utf-8'))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import unittest
|
||||||
|
unittest.main()
|
||||||
@@ -0,0 +1,137 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
|
|
||||||
|
from flask import json
|
||||||
|
from six import BytesIO
|
||||||
|
|
||||||
|
from swagger_server.models.terminoloski_kandidat import TerminoloskiKandidat # noqa: E501
|
||||||
|
from swagger_server.test import BaseTestCase
|
||||||
|
|
||||||
|
|
||||||
|
class TestOssController(BaseTestCase):
|
||||||
|
"""OssController integration test stubs"""
|
||||||
|
|
||||||
|
def test_get_conllu(self):
|
||||||
|
"""Test case for get_conllu
|
||||||
|
|
||||||
|
Vrne CoNNL-U po id-ju datoteke
|
||||||
|
"""
|
||||||
|
query_string = [('id', 789)]
|
||||||
|
response = self.client.open(
|
||||||
|
'/oss/conlluPoId',
|
||||||
|
method='GET',
|
||||||
|
query_string=query_string)
|
||||||
|
self.assert200(response,
|
||||||
|
'Response body is : ' + response.data.decode('utf-8'))
|
||||||
|
|
||||||
|
def test_get_conllus(self):
|
||||||
|
"""Test case for get_conllus
|
||||||
|
|
||||||
|
Vrne seznam CoNNL-U-jev glede na iskalne pogoje
|
||||||
|
"""
|
||||||
|
query_string = [('leta', 56),
|
||||||
|
('vrste', 'vrste_example'),
|
||||||
|
('kljucnebesede', 'kljucnebesede_example'),
|
||||||
|
('cerifpodrocja', 56)]
|
||||||
|
response = self.client.open(
|
||||||
|
'/oss/conlluPoIskanju',
|
||||||
|
method='GET',
|
||||||
|
query_string=query_string)
|
||||||
|
self.assert200(response,
|
||||||
|
'Response body is : ' + response.data.decode('utf-8'))
|
||||||
|
|
||||||
|
def test_get_extracted_words(self):
|
||||||
|
"""Test case for get_extracted_words
|
||||||
|
|
||||||
|
Vrne terminloške kandidate glede na
|
||||||
|
"""
|
||||||
|
query_string = [('leta', 56),
|
||||||
|
('vrste', 'vrste_example'),
|
||||||
|
('kljucnebesede', 'kljucnebesede_example'),
|
||||||
|
('cerifpodrocja', 56)]
|
||||||
|
response = self.client.open(
|
||||||
|
'/oss/izlusciPoIskanju',
|
||||||
|
method='GET',
|
||||||
|
query_string=query_string)
|
||||||
|
self.assert200(response,
|
||||||
|
'Response body is : ' + response.data.decode('utf-8'))
|
||||||
|
|
||||||
|
def test_get_file(self):
|
||||||
|
"""Test case for get_file
|
||||||
|
|
||||||
|
Vrne binarni zapis v originalnem formatu po id-ju datoteke
|
||||||
|
"""
|
||||||
|
query_string = [('id', 789)]
|
||||||
|
response = self.client.open(
|
||||||
|
'/oss/datotekaPoId',
|
||||||
|
method='GET',
|
||||||
|
query_string=query_string)
|
||||||
|
self.assert200(response,
|
||||||
|
'Response body is : ' + response.data.decode('utf-8'))
|
||||||
|
|
||||||
|
def test_get_files(self):
|
||||||
|
"""Test case for get_files
|
||||||
|
|
||||||
|
Vrne seznam binarnih zapisov v originalnem formatu glede na iskalne pogoje
|
||||||
|
"""
|
||||||
|
query_string = [('leta', 56),
|
||||||
|
('vrste', 'vrste_example'),
|
||||||
|
('kljucnebesede', 'kljucnebesede_example'),
|
||||||
|
('cerifpodrocja', 56)]
|
||||||
|
response = self.client.open(
|
||||||
|
'/oss/datotekePoIskanju',
|
||||||
|
method='GET',
|
||||||
|
query_string=query_string)
|
||||||
|
self.assert200(response,
|
||||||
|
'Response body is : ' + response.data.decode('utf-8'))
|
||||||
|
|
||||||
|
def test_get_number_texts(self):
|
||||||
|
"""Test case for get_number_texts
|
||||||
|
|
||||||
|
Vrne število besedil glede na iskalne pogoje
|
||||||
|
"""
|
||||||
|
query_string = [('leta', 56),
|
||||||
|
('vrste', 'vrste_example'),
|
||||||
|
('kljucnebesede', 'kljucnebesede_example'),
|
||||||
|
('cerifpodrocja', 56)]
|
||||||
|
response = self.client.open(
|
||||||
|
'/oss/steviloBesedilPoIskanju',
|
||||||
|
method='GET',
|
||||||
|
query_string=query_string)
|
||||||
|
self.assert200(response,
|
||||||
|
'Response body is : ' + response.data.decode('utf-8'))
|
||||||
|
|
||||||
|
def test_get_texts(self):
|
||||||
|
"""Test case for get_texts
|
||||||
|
|
||||||
|
Vrne seznam besedil glede na iskalne pogoje
|
||||||
|
"""
|
||||||
|
query_string = [('leta', 56),
|
||||||
|
('vrste', 'vrste_example'),
|
||||||
|
('kljucnebesede', 'kljucnebesede_example'),
|
||||||
|
('cerifpodrocja', 56)]
|
||||||
|
response = self.client.open(
|
||||||
|
'/oss/besedilaPoIskanju',
|
||||||
|
method='GET',
|
||||||
|
query_string=query_string)
|
||||||
|
self.assert200(response,
|
||||||
|
'Response body is : ' + response.data.decode('utf-8'))
|
||||||
|
|
||||||
|
def test_oss_besedilo_po_id_get(self):
|
||||||
|
"""Test case for oss_besedilo_po_id_get
|
||||||
|
|
||||||
|
Vrne besedilo po id-ju datoteke
|
||||||
|
"""
|
||||||
|
query_string = [('id', 789)]
|
||||||
|
response = self.client.open(
|
||||||
|
'/oss/besediloPoId',
|
||||||
|
method='GET',
|
||||||
|
query_string=query_string)
|
||||||
|
self.assert200(response,
|
||||||
|
'Response body is : ' + response.data.decode('utf-8'))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import unittest
|
||||||
|
unittest.main()
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
if sys.version_info < (3, 7):
|
||||||
|
import typing
|
||||||
|
|
||||||
|
def is_generic(klass):
|
||||||
|
""" Determine whether klass is a generic class """
|
||||||
|
return type(klass) == typing.GenericMeta
|
||||||
|
|
||||||
|
def is_dict(klass):
|
||||||
|
""" Determine whether klass is a Dict """
|
||||||
|
return klass.__extra__ == dict
|
||||||
|
|
||||||
|
def is_list(klass):
|
||||||
|
""" Determine whether klass is a List """
|
||||||
|
return klass.__extra__ == list
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
def is_generic(klass):
|
||||||
|
""" Determine whether klass is a generic class """
|
||||||
|
return hasattr(klass, '__origin__')
|
||||||
|
|
||||||
|
def is_dict(klass):
|
||||||
|
""" Determine whether klass is a Dict """
|
||||||
|
return klass.__origin__ == dict
|
||||||
|
|
||||||
|
def is_list(klass):
|
||||||
|
""" Determine whether klass is a List """
|
||||||
|
return klass.__origin__ == list
|
||||||
@@ -0,0 +1,142 @@
|
|||||||
|
import datetime
|
||||||
|
|
||||||
|
import six
|
||||||
|
import typing
|
||||||
|
from swagger_server import type_util
|
||||||
|
|
||||||
|
|
||||||
|
def _deserialize(data, klass):
|
||||||
|
"""Deserializes dict, list, str into an object.
|
||||||
|
|
||||||
|
:param data: dict, list or str.
|
||||||
|
:param klass: class literal, or string of class name.
|
||||||
|
|
||||||
|
:return: object.
|
||||||
|
"""
|
||||||
|
if data is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if klass in six.integer_types or klass in (float, str, bool, bytearray):
|
||||||
|
return _deserialize_primitive(data, klass)
|
||||||
|
elif klass == object:
|
||||||
|
return _deserialize_object(data)
|
||||||
|
elif klass == datetime.date:
|
||||||
|
return deserialize_date(data)
|
||||||
|
elif klass == datetime.datetime:
|
||||||
|
return deserialize_datetime(data)
|
||||||
|
elif type_util.is_generic(klass):
|
||||||
|
if type_util.is_list(klass):
|
||||||
|
return _deserialize_list(data, klass.__args__[0])
|
||||||
|
if type_util.is_dict(klass):
|
||||||
|
return _deserialize_dict(data, klass.__args__[1])
|
||||||
|
else:
|
||||||
|
return deserialize_model(data, klass)
|
||||||
|
|
||||||
|
|
||||||
|
def _deserialize_primitive(data, klass):
|
||||||
|
"""Deserializes to primitive type.
|
||||||
|
|
||||||
|
:param data: data to deserialize.
|
||||||
|
:param klass: class literal.
|
||||||
|
|
||||||
|
:return: int, long, float, str, bool.
|
||||||
|
:rtype: int | long | float | str | bool
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
value = klass(data)
|
||||||
|
except UnicodeEncodeError:
|
||||||
|
value = six.u(data)
|
||||||
|
except TypeError:
|
||||||
|
value = data
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
def _deserialize_object(value):
|
||||||
|
"""Return an original value.
|
||||||
|
|
||||||
|
:return: object.
|
||||||
|
"""
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
def deserialize_date(string):
|
||||||
|
"""Deserializes string to date.
|
||||||
|
|
||||||
|
:param string: str.
|
||||||
|
:type string: str
|
||||||
|
:return: date.
|
||||||
|
:rtype: date
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
from dateutil.parser import parse
|
||||||
|
return parse(string).date()
|
||||||
|
except ImportError:
|
||||||
|
return string
|
||||||
|
|
||||||
|
|
||||||
|
def deserialize_datetime(string):
|
||||||
|
"""Deserializes string to datetime.
|
||||||
|
|
||||||
|
The string should be in iso8601 datetime format.
|
||||||
|
|
||||||
|
:param string: str.
|
||||||
|
:type string: str
|
||||||
|
:return: datetime.
|
||||||
|
:rtype: datetime
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
from dateutil.parser import parse
|
||||||
|
return parse(string)
|
||||||
|
except ImportError:
|
||||||
|
return string
|
||||||
|
|
||||||
|
|
||||||
|
def deserialize_model(data, klass):
|
||||||
|
"""Deserializes list or dict to model.
|
||||||
|
|
||||||
|
:param data: dict, list.
|
||||||
|
:type data: dict | list
|
||||||
|
:param klass: class literal.
|
||||||
|
:return: model object.
|
||||||
|
"""
|
||||||
|
instance = klass()
|
||||||
|
|
||||||
|
if not instance.swagger_types:
|
||||||
|
return data
|
||||||
|
|
||||||
|
for attr, attr_type in six.iteritems(instance.swagger_types):
|
||||||
|
if data is not None \
|
||||||
|
and instance.attribute_map[attr] in data \
|
||||||
|
and isinstance(data, (list, dict)):
|
||||||
|
value = data[instance.attribute_map[attr]]
|
||||||
|
setattr(instance, attr, _deserialize(value, attr_type))
|
||||||
|
|
||||||
|
return instance
|
||||||
|
|
||||||
|
|
||||||
|
def _deserialize_list(data, boxed_type):
|
||||||
|
"""Deserializes a list and its elements.
|
||||||
|
|
||||||
|
:param data: list to deserialize.
|
||||||
|
:type data: list
|
||||||
|
:param boxed_type: class literal.
|
||||||
|
|
||||||
|
:return: deserialized list.
|
||||||
|
:rtype: list
|
||||||
|
"""
|
||||||
|
return [_deserialize(sub_data, boxed_type)
|
||||||
|
for sub_data in data]
|
||||||
|
|
||||||
|
|
||||||
|
def _deserialize_dict(data, boxed_type):
|
||||||
|
"""Deserializes a dict and its elements.
|
||||||
|
|
||||||
|
:param data: dict to deserialize.
|
||||||
|
:type data: dict
|
||||||
|
:param boxed_type: class literal.
|
||||||
|
|
||||||
|
:return: deserialized dict.
|
||||||
|
:rtype: dict
|
||||||
|
"""
|
||||||
|
return {k: _deserialize(v, boxed_type)
|
||||||
|
for k, v in six.iteritems(data)}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
flask_testing==0.8.0
|
||||||
|
coverage>=4.0.3
|
||||||
|
nose>=1.3.7
|
||||||
|
pluggy>=0.3.1
|
||||||
|
py>=1.4.31
|
||||||
|
randomize>=0.13
|
||||||
|
tox==3.20.1
|
||||||
Reference in New Issue
Block a user