Initial commit
This commit is contained in:
@@ -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)}
|
||||
Reference in New Issue
Block a user