mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-14 16:55:42 +00:00
Make inner package imports relative
This commit is contained in:
parent
3bbe45d015
commit
4294c2854b
@ -1,50 +0,0 @@
|
||||
# Corpus Analysis
|
||||
|
||||
## Start einer Session
|
||||
|
||||
```javascript
|
||||
nopaque.socket.emit("corpus_analysis_init", <corpusId>);
|
||||
<corpusId> ~ number
|
||||
// Show init loading modal
|
||||
|
||||
nopaque.socket.on("corpus_analysis_init", <response>);
|
||||
<response> ~ {"code": <code>, "msg": <message>}
|
||||
<code> ~ number // HTTP status code
|
||||
<msg> ~ string
|
||||
// Hide init loading modal
|
||||
```
|
||||
|
||||
## Ausführen einer Suchanfrage
|
||||
|
||||
Ergebnisse werden Stückchenweise als "chunks" übertragen.
|
||||
|
||||
```javascript
|
||||
nopaque.socket.emit("corpus_analysis_query", <query>);
|
||||
<query> ~ string
|
||||
// Clear result data store and list
|
||||
result = {"query": <query>};
|
||||
// Hide query result card
|
||||
// Show query loading card
|
||||
nopaque.socket.on("corpus_analysis_query", <response>);
|
||||
<response>: {"code": <code>, "result": <result>}
|
||||
<code> ~ number // Error, Success
|
||||
<result> ~ {"matches": [<cpos>, ...],
|
||||
"num_matches": <num_matches>,
|
||||
"cpos_lookup": {<cpos>: <token>, ...},
|
||||
"text_lookup": {<textId>: <text>, ...}}
|
||||
<cpos> ~ number
|
||||
<num_matches> ~ number
|
||||
<token> ~ {"word": <word>, "lemma": <lemma>, "simple_pos": <simple_pos>, "pos": <pos>, "ner": <ner>, "text": <textId>, "s": <sId>}
|
||||
<word> ~ string
|
||||
<lemma> ~ string
|
||||
<simple_pos> ~ string
|
||||
<pos> ~ string
|
||||
<ner> ~ string
|
||||
<textId> ~ number
|
||||
<sId> ~ number
|
||||
<text> ~ {"author": <author>, "title": <text>, ...}
|
||||
<s> ~ string
|
||||
// Process response
|
||||
// Hide query result card
|
||||
// Show query loading card
|
||||
```
|
@ -2,4 +2,4 @@ from flask import Blueprint
|
||||
|
||||
|
||||
admin = Blueprint('admin', __name__)
|
||||
from . import views
|
||||
from . import views # noqa
|
||||
|
@ -1,8 +1,8 @@
|
||||
from app.models import Role, User
|
||||
from flask_wtf import FlaskForm
|
||||
from wtforms import (BooleanField, SelectField, StringField, SubmitField,
|
||||
ValidationError)
|
||||
from wtforms.validators import DataRequired, Email, Length, Regexp
|
||||
from ..models import Role, User
|
||||
|
||||
|
||||
class EditUserForm(FlaskForm):
|
||||
|
@ -1,13 +1,13 @@
|
||||
from app import db
|
||||
from app.decorators import admin_required
|
||||
from app.models import Role, User
|
||||
from app.profile.background_functions import delete_user_
|
||||
from flask import current_app, flash, redirect, render_template, url_for
|
||||
from flask_login import login_required
|
||||
from threading import Thread
|
||||
from . import admin
|
||||
from .forms import EditUserForm
|
||||
from .tables import AdminUserItem, AdminUserTable
|
||||
from .. import db
|
||||
from ..decorators import admin_required
|
||||
from ..models import Role, User
|
||||
from ..profile.background_functions import delete_user_
|
||||
|
||||
|
||||
@admin.route('/')
|
||||
|
@ -2,4 +2,4 @@ from flask import Blueprint
|
||||
|
||||
|
||||
auth = Blueprint('auth', __name__)
|
||||
from . import views
|
||||
from . import views # noqa
|
||||
|
@ -1,4 +1,4 @@
|
||||
from app.models import User
|
||||
from ..models import User
|
||||
from flask_wtf import FlaskForm
|
||||
from wtforms import (BooleanField, PasswordField, StringField, SubmitField,
|
||||
ValidationError)
|
||||
|
@ -1,12 +1,12 @@
|
||||
from app import db, logger
|
||||
from app.email import send_email
|
||||
from app.models import User
|
||||
from flask import (current_app, flash, redirect, render_template, request,
|
||||
url_for)
|
||||
from flask_login import current_user, login_user, login_required, logout_user
|
||||
from . import auth
|
||||
from .forms import (LoginForm, ResetPasswordForm, ResetPasswordRequestForm,
|
||||
RegistrationForm)
|
||||
from .. import db
|
||||
from ..email import send_email
|
||||
from ..models import User
|
||||
import os
|
||||
import shutil
|
||||
|
||||
|
@ -2,4 +2,4 @@ from flask import Blueprint
|
||||
|
||||
|
||||
corpora = Blueprint('corpora', __name__)
|
||||
from . import events, views
|
||||
from . import events, views # noqa
|
||||
|
@ -1,4 +1,4 @@
|
||||
from app.models import Corpus, CorpusFile
|
||||
from ..models import Corpus, CorpusFile
|
||||
|
||||
|
||||
def delete_corpus_(app, corpus_id):
|
||||
|
@ -1,10 +1,10 @@
|
||||
from app import db, logger, socketio
|
||||
from app.decorators import socketio_login_required
|
||||
from app.events import connected_sessions
|
||||
from app.models import Corpus, User
|
||||
from .cqi import CQiClient
|
||||
from flask import current_app, request
|
||||
from flask_login import current_user
|
||||
from .cqi import CQiClient
|
||||
from .. import db, logger, socketio
|
||||
from ..decorators import socketio_login_required
|
||||
from ..events import connected_sessions
|
||||
from ..models import Corpus, User
|
||||
import math
|
||||
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
from app import db, logger
|
||||
from app.models import Corpus, CorpusFile
|
||||
from flask import (abort, current_app, flash, redirect, request,
|
||||
render_template, url_for, send_from_directory)
|
||||
from flask_login import current_user, login_required
|
||||
@ -10,6 +8,8 @@ from .background_functions import (delete_corpus_, delete_corpus_file_,
|
||||
edit_corpus_file_)
|
||||
from .forms import (AddCorpusFileForm, AddCorpusForm, EditCorpusFileForm,
|
||||
QueryDownloadForm, QueryForm)
|
||||
from .. import db
|
||||
from ..models import Corpus, CorpusFile
|
||||
import os
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
from functools import wraps
|
||||
from flask import abort
|
||||
from flask_login import current_user
|
||||
from flask_socketio import disconnect
|
||||
from functools import wraps
|
||||
from .models import Permission
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
from threading import Thread
|
||||
from flask import current_app, render_template
|
||||
from flask_mail import Message
|
||||
from threading import Thread
|
||||
from . import mail
|
||||
|
||||
|
||||
|
@ -2,4 +2,4 @@ from flask import Blueprint
|
||||
|
||||
|
||||
jobs = Blueprint('jobs', __name__)
|
||||
from . import views
|
||||
from . import views # noqa
|
||||
|
@ -1,4 +1,4 @@
|
||||
from app.models import Job
|
||||
from ..models import Job
|
||||
|
||||
|
||||
def delete_job_(app, job_id):
|
||||
|
@ -1,10 +1,10 @@
|
||||
from app.models import Job, JobInput, JobResult
|
||||
from flask import (abort, current_app, flash, redirect, render_template,
|
||||
send_from_directory, url_for)
|
||||
from flask_login import current_user, login_required
|
||||
from threading import Thread
|
||||
from . import jobs
|
||||
from .background_functions import delete_job_
|
||||
from ..models import Job, JobInput, JobResult
|
||||
import os
|
||||
|
||||
|
||||
|
@ -2,10 +2,4 @@ from flask import Blueprint
|
||||
|
||||
|
||||
main = Blueprint('main', __name__)
|
||||
from . import errors, views
|
||||
from app.models import Permission
|
||||
|
||||
|
||||
@main.app_context_processor
|
||||
def inject_permissions():
|
||||
return dict(Permission=Permission)
|
||||
from . import errors, views # noqa
|
||||
|
@ -1,11 +1,10 @@
|
||||
from app import logger
|
||||
from app.auth.forms import LoginForm
|
||||
from app.models import User
|
||||
from flask import flash, redirect, render_template, url_for
|
||||
from flask_login import login_required, login_user
|
||||
from . import main
|
||||
from .forms import FeedbackForm
|
||||
|
||||
from .. import logger
|
||||
from ..auth.forms import LoginForm
|
||||
from ..models import User
|
||||
|
||||
@main.route('/', methods=['GET', 'POST'])
|
||||
def index():
|
||||
|
@ -2,4 +2,4 @@ from flask import Blueprint
|
||||
|
||||
|
||||
profile = Blueprint('profile', __name__)
|
||||
from . import views
|
||||
from . import views # noqa
|
||||
|
@ -1,4 +1,4 @@
|
||||
from app.models import User
|
||||
from ..models import User
|
||||
|
||||
|
||||
def delete_user_(app, user_id):
|
||||
|
@ -1,10 +1,10 @@
|
||||
from app import db
|
||||
from flask import current_app, flash, redirect, render_template, url_for
|
||||
from flask_login import current_user, login_required, logout_user
|
||||
from threading import Thread
|
||||
from . import profile
|
||||
from .background_functions import delete_user_
|
||||
from .forms import EditEmailForm, EditGeneralSettingsForm, EditPasswordForm
|
||||
from .. import db
|
||||
|
||||
|
||||
@profile.route('/settings', methods=['GET', 'POST'])
|
||||
|
@ -2,4 +2,4 @@ from flask import Blueprint
|
||||
|
||||
|
||||
services = Blueprint('services', __name__)
|
||||
from . import views
|
||||
from . import views # noqa
|
||||
|
@ -1,14 +1,13 @@
|
||||
from app import db
|
||||
from app.jobs.forms import AddNLPJobForm, AddOCRJobForm, AddSetupFilesJobForm
|
||||
from app.models import Job, JobInput
|
||||
from flask import (abort, current_app, flash, make_response, render_template,
|
||||
url_for)
|
||||
from flask_login import current_user, login_required
|
||||
from werkzeug.utils import secure_filename
|
||||
from . import services
|
||||
from .. import db
|
||||
from ..jobs.forms import AddNLPJobForm, AddOCRJobForm, AddSetupFilesJobForm
|
||||
from ..models import Job, JobInput
|
||||
import json
|
||||
import os
|
||||
from app import logger
|
||||
|
||||
|
||||
SERVICES = {'corpus_analysis': {'name': 'Corpus analysis'},
|
||||
|
@ -1,5 +0,0 @@
|
||||
from flask import Blueprint
|
||||
|
||||
|
||||
test = Blueprint('test', __name__)
|
||||
from . import events, views
|
@ -1,23 +0,0 @@
|
||||
from app import logger, socketio
|
||||
from flask_login import login_required
|
||||
from werkzeug.datastructures import FileStorage
|
||||
from werkzeug.utils import secure_filename
|
||||
from .forms import TestForm
|
||||
import io
|
||||
|
||||
|
||||
@socketio.on('submit-test-form')
|
||||
@login_required
|
||||
def recv_test_form(data):
|
||||
logger.warning("data_received")
|
||||
filename = secure_filename(data['file-wrapper']['name'])
|
||||
stream = io.BytesIO(data['file-wrapper']['bytes'])
|
||||
file = FileStorage(filename=filename, stream=stream)
|
||||
data['file'] = file
|
||||
test_form = TestForm(data=data)
|
||||
if test_form.validate():
|
||||
socketio.emit('submit-test-form', {'msg': {},
|
||||
'status': 201})
|
||||
else:
|
||||
socketio.emit('submit-test-form', {'msg': test_form.errors,
|
||||
'status': 400})
|
@ -1,12 +0,0 @@
|
||||
from flask_wtf import FlaskForm
|
||||
from flask_wtf.file import FileAllowed, FileField, FileRequired
|
||||
from wtforms import StringField, SubmitField
|
||||
from wtforms.validators import DataRequired, Length
|
||||
|
||||
|
||||
class TestForm(FlaskForm):
|
||||
description = StringField('Description',
|
||||
validators=[DataRequired(), Length(1, 255)])
|
||||
file = FileField('File', validators=[FileAllowed(['txt'], 'Plain text only!'), FileRequired()])
|
||||
submit = SubmitField()
|
||||
title = StringField('Title', validators=[DataRequired(), Length(1, 32)])
|
@ -1,12 +0,0 @@
|
||||
from flask import render_template
|
||||
from flask_login import login_required
|
||||
from . import test
|
||||
from .forms import TestForm
|
||||
|
||||
|
||||
@test.route('/')
|
||||
@login_required
|
||||
def index():
|
||||
test_form = TestForm()
|
||||
return render_template('test/index.html.j2', title='Test',
|
||||
test_form=test_form)
|
@ -1,5 +1,5 @@
|
||||
import eventlet
|
||||
eventlet.monkey_patch()
|
||||
eventlet.monkey_patch() # noqa: E261
|
||||
from app import create_app, db, socketio
|
||||
from app.models import Corpus, Job, Role, User
|
||||
from flask_migrate import Migrate
|
||||
|
@ -1,7 +1,5 @@
|
||||
import re
|
||||
import unittest
|
||||
from app import create_app, db
|
||||
from app.models import User, Role
|
||||
|
||||
|
||||
class FlaskClientTestCase(unittest.TestCase):
|
||||
|
Loading…
Reference in New Issue
Block a user