Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Now uses grammar endpoint on api.greynir.is. #19

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

KariSt1
Copy link

@KariSt1 KariSt1 commented Sep 11, 2023

Still synchronous and does not display progress. At the moment GreynirSeqAPI doesn't return the "details" for a given error so it is not displayed on the interface.

Things that are still left to do before merging:

  • Make the grammar endpoint asynchronous
  • Display progress
  • Remove old endpoints
  • Clean up unused code from previous functionality

from datetime import datetime
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Pattern, Tuple, Union, cast
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, it is canonical to have imports from typing first in the import sequence...


app.register_blueprint(routes_blueprint)

from routes import start_task_cleanup_thread
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, where did these go? It's not possible to delete them completely?

dirs: List[str] = list(
map(os.path.dirname, [__file__, reynir.__file__, reynir_correct.__file__]) # type: ignore
)
dirs: List[str] = list(map(os.path.dirname, [__file__, reynir.__file__])) # type: ignore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think type:ignore might no longer be needed - it's probably there because of an early bug in Pylance.

@@ -350,7 +313,4 @@ def resource_gone(e: BaseException) -> Tuple[Response, int]:
)
app.logger.info(log_str) # type: ignore

# Pre-load the correction engine into memory
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was there to make the first request response time a bit lower, while taking a tiny bit more time to initialize the server.


from correct import check_grammar, validate_token_and_nonce
from doc import SUPPORTED_DOC_MIMETYPES, doc_class_for_mime_type
from typing_extensions import Literal
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be importable from typing now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants