There will be a small downtime on Friday 16.04 between 15:00 and 18:00 (Gitlab upgrade).

If necessary contact me at mateusz.gniewkowski@pwr.edu.pl

Commit 9b717f76 authored by Leszek Szymczak's avatar Leszek Szymczak Committed by Mateusz Gniewkowski

Polem2rancher

parent 30fd750f
image: clarinpl/python:3.6
cache:
paths:
- .tox
stages:
- check_style
- build
before_script:
- pip install tox==2.9.1
pep8:
stage: check_style
script:
- tox -v -e pep8
docstyle:
stage: check_style
script:
- tox -v -e docstyle
build_image:
stage: build
image: docker:18.09.7
only:
- master
services:
- docker:18.09.7-dind
before_script:
- ''
script:
- docker build -t clarinpl/polem .
- echo $DOCKER_PASSWORD > pass.txt
- cat pass.txt | docker login --username $DOCKER_USERNAME --password-stdin
- rm pass.txt
- docker push clarinpl/polem
"""Implementation of polem service."""
import WrapLem
import lex_ws
class Polem(lex_ws.LexWorker):
@classmethod
def static_init(cls, config):
pass
@classmethod
def static_close(cls):
pass
"""Implements lex_worker for polem service. It's a mock object."""
def init(self):
"""Initializes lemmatizer."""
self._lemmatizer = WrapLem.CascadeLemmatizer.assembleLemmatizer()
def processold(self, task_options):
def process(self, task_options):
"""Runs single polem task."""
output = []
for lexeme in task_options['lexeme_polem']:
output.append(self._lemmatizer.lemmatizeS(lexeme[0], lexeme[1], lexeme[2], False))
return output
def process(self, task_options):
output = []
for lexeme in task_options['lexeme_polem']:
if len(lexeme) == 3:
output.append(self._lemmatizer.lemmatizeS(lexeme[0], lexeme[1], lexeme[2], False))
elif len(lexeme) == 5:
output.append(self._lemmatizer.lemmatizeS(lexeme[0], lexeme[1], lexeme[2], lexeme[3], lexeme[4], False))
if len(lexeme) == 3 or len(lexeme) == 5:
output.append(self._lemmatizer.lemmatizeS(*lexeme, False))
else:
raise Exception("Invalid number of arguments")
return output
raise Exception("Invalid number of arguments")
return output
if __name__ == '__main__':
lex_ws.LexService.main(Polem)
[tox]
envlist = pep8,docstyle
skipsdist = True
[testenv:pep8]
deps =
flake8
basepython = python3
commands =
flake8 {posargs}
[testenv:docstyle]
deps =
pydocstyle
basepython = python3
commands =
pydocstyle --verbose {posargs}
[flake8]
# W504 skipped because it is overeager and unnecessary
ignore = W504
show-source = True
exclude = .git,.venv,.tox,dist,doc,*egg,build,venv
import-order-style = pep8
max-line-length = 80
[pydocstyle]
# D104 Missing docstring in public package
# D203 1 blank line required before class docstring
# D213 Multi-line docstring summary should start at the second line
# D214 Section is over-indented
# D215 Section underline is over-indented
# D401 First line should be in imperative mood; try rephrasing
# D405 Section name should be properly capitalized
# D406 Section name should end with a newline
# D407 Missing dashed underline after section
# D408 Section underline should be in the line following the section’s name
# D409 Section underline should match the length of its name
# D410 Missing blank line after section
# D411 Missing blank line before section
ignore = D104,D203,D213,D214,D215,D401,D405,D406,D407,D408,D409,D410,D411
match-dir = ^(?!\.tox|venv).*
match = ^(?!setup).*\.py
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment