- [nexus] Use non-vendored version of nlptools

- [nexus] Remove protos

GitOrigin-RevId: 1bc308a6c3056b2509952e4b53122f4fd1a9960d
This commit is contained in:
the-superpirate 2022-09-02 19:10:05 +03:00
parent 43be16e4bc
commit 51ae1fc5d9
7 changed files with 6 additions and 346 deletions

View File

@ -1,11 +1,11 @@
import io
import re
from izihawa_nlptools.utils import cast_string_to_single_string
from library.telegram.base import RequestContext
from library.telegram.common import close_button
from library.telegram.utils import safe_execution
from nexus.translations import t
from nlptools.izihawa_nlptools.utils import cast_string_to_single_string
from telethon import events
from telethon.tl.types import DocumentAttributeFilename

View File

@ -8,9 +8,9 @@ from datetime import (
)
from aiokit import AioThing
from izihawa_nlptools.regex import DOI_REGEX
from library.telegram.utils import safe_execution
from nexus.views.telegram.scimag import ScimagViewBuilder
from nlptools.izihawa_nlptools.regex import DOI_REGEX
class MutualAidService(AioThing):

View File

@ -1,79 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: nexus/meta_api/proto/documents_service.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from nexus.models.proto import \
typed_document_pb2 as nexus_dot_models_dot_proto_dot_typed__document__pb2
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n,nexus/meta_api/proto/documents_service.proto\x12\x14nexus.meta_api.proto\x1a\'nexus/models/proto/typed_document.proto\"`\n\x0bRollRequest\x12\x1f\n\x0bindex_alias\x18\x01 \x01(\tR\nindexAlias\x12\x14\n\x05query\x18\x02 \x01(\tR\x05query\x12\x1a\n\x08language\x18\x03 \x01(\tR\x08language\"X\n\x0cRollResponse\x12H\n\x0etyped_document\x18\x01 \x01(\x0b\x32!.nexus.models.proto.TypedDocumentR\rtypedDocument\"b\n\x10TopMissedRequest\x12\x12\n\x04page\x18\x01 \x01(\rR\x04page\x12\x1b\n\tpage_size\x18\x02 \x01(\rR\x08pageSize\x12\x1d\n\ndoi_prefix\x18\x03 \x01(\tR\tdoiPrefix\"z\n\x11TopMissedResponse\x12J\n\x0ftyped_documents\x18\x01 \x03(\x0b\x32!.nexus.models.proto.TypedDocumentR\x0etypedDocuments\x12\x19\n\x08has_next\x18\x02 \x01(\x08R\x07hasNext\"\x88\x01\n\x14TypedDocumentRequest\x12\x1f\n\x0bindex_alias\x18\x01 \x01(\tR\nindexAlias\x12\x1f\n\x0b\x64ocument_id\x18\x02 \x01(\x04R\ndocumentId\x12\x1a\n\x08position\x18\x03 \x01(\rR\x08position\x12\x12\n\x04mode\x18\x04 \x01(\tR\x04mode2\x95\x02\n\tDocuments\x12V\n\x03get\x12*.nexus.meta_api.proto.TypedDocumentRequest\x1a!.nexus.models.proto.TypedDocument\"\x00\x12O\n\x04roll\x12!.nexus.meta_api.proto.RollRequest\x1a\".nexus.meta_api.proto.RollResponse\"\x00\x12_\n\ntop_missed\x12&.nexus.meta_api.proto.TopMissedRequest\x1a\'.nexus.meta_api.proto.TopMissedResponse\"\x00\x62\x06proto3')
_ROLLREQUEST = DESCRIPTOR.message_types_by_name['RollRequest']
_ROLLRESPONSE = DESCRIPTOR.message_types_by_name['RollResponse']
_TOPMISSEDREQUEST = DESCRIPTOR.message_types_by_name['TopMissedRequest']
_TOPMISSEDRESPONSE = DESCRIPTOR.message_types_by_name['TopMissedResponse']
_TYPEDDOCUMENTREQUEST = DESCRIPTOR.message_types_by_name['TypedDocumentRequest']
RollRequest = _reflection.GeneratedProtocolMessageType('RollRequest', (_message.Message,), {
'DESCRIPTOR' : _ROLLREQUEST,
'__module__' : 'nexus.meta_api.proto.documents_service_pb2'
# @@protoc_insertion_point(class_scope:nexus.meta_api.proto.RollRequest)
})
_sym_db.RegisterMessage(RollRequest)
RollResponse = _reflection.GeneratedProtocolMessageType('RollResponse', (_message.Message,), {
'DESCRIPTOR' : _ROLLRESPONSE,
'__module__' : 'nexus.meta_api.proto.documents_service_pb2'
# @@protoc_insertion_point(class_scope:nexus.meta_api.proto.RollResponse)
})
_sym_db.RegisterMessage(RollResponse)
TopMissedRequest = _reflection.GeneratedProtocolMessageType('TopMissedRequest', (_message.Message,), {
'DESCRIPTOR' : _TOPMISSEDREQUEST,
'__module__' : 'nexus.meta_api.proto.documents_service_pb2'
# @@protoc_insertion_point(class_scope:nexus.meta_api.proto.TopMissedRequest)
})
_sym_db.RegisterMessage(TopMissedRequest)
TopMissedResponse = _reflection.GeneratedProtocolMessageType('TopMissedResponse', (_message.Message,), {
'DESCRIPTOR' : _TOPMISSEDRESPONSE,
'__module__' : 'nexus.meta_api.proto.documents_service_pb2'
# @@protoc_insertion_point(class_scope:nexus.meta_api.proto.TopMissedResponse)
})
_sym_db.RegisterMessage(TopMissedResponse)
TypedDocumentRequest = _reflection.GeneratedProtocolMessageType('TypedDocumentRequest', (_message.Message,), {
'DESCRIPTOR' : _TYPEDDOCUMENTREQUEST,
'__module__' : 'nexus.meta_api.proto.documents_service_pb2'
# @@protoc_insertion_point(class_scope:nexus.meta_api.proto.TypedDocumentRequest)
})
_sym_db.RegisterMessage(TypedDocumentRequest)
_DOCUMENTS = DESCRIPTOR.services_by_name['Documents']
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
_ROLLREQUEST._serialized_start=111
_ROLLREQUEST._serialized_end=207
_ROLLRESPONSE._serialized_start=209
_ROLLRESPONSE._serialized_end=297
_TOPMISSEDREQUEST._serialized_start=299
_TOPMISSEDREQUEST._serialized_end=397
_TOPMISSEDRESPONSE._serialized_start=399
_TOPMISSEDRESPONSE._serialized_end=521
_TYPEDDOCUMENTREQUEST._serialized_start=524
_TYPEDDOCUMENTREQUEST._serialized_end=660
_DOCUMENTS._serialized_start=663
_DOCUMENTS._serialized_end=940
# @@protoc_insertion_point(module_scope)

View File

@ -1,135 +0,0 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from nexus.meta_api.proto import \
documents_service_pb2 as \
nexus_dot_meta__api_dot_proto_dot_documents__service__pb2
from nexus.models.proto import \
typed_document_pb2 as nexus_dot_models_dot_proto_dot_typed__document__pb2
class DocumentsStub(object):
"""Missing associated documentation comment in .proto file."""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.get = channel.unary_unary(
'/nexus.meta_api.proto.Documents/get',
request_serializer=nexus_dot_meta__api_dot_proto_dot_documents__service__pb2.TypedDocumentRequest.SerializeToString,
response_deserializer=nexus_dot_models_dot_proto_dot_typed__document__pb2.TypedDocument.FromString,
)
self.roll = channel.unary_unary(
'/nexus.meta_api.proto.Documents/roll',
request_serializer=nexus_dot_meta__api_dot_proto_dot_documents__service__pb2.RollRequest.SerializeToString,
response_deserializer=nexus_dot_meta__api_dot_proto_dot_documents__service__pb2.RollResponse.FromString,
)
self.top_missed = channel.unary_unary(
'/nexus.meta_api.proto.Documents/top_missed',
request_serializer=nexus_dot_meta__api_dot_proto_dot_documents__service__pb2.TopMissedRequest.SerializeToString,
response_deserializer=nexus_dot_meta__api_dot_proto_dot_documents__service__pb2.TopMissedResponse.FromString,
)
class DocumentsServicer(object):
"""Missing associated documentation comment in .proto file."""
def get(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def roll(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def top_missed(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def add_DocumentsServicer_to_server(servicer, server):
rpc_method_handlers = {
'get': grpc.unary_unary_rpc_method_handler(
servicer.get,
request_deserializer=nexus_dot_meta__api_dot_proto_dot_documents__service__pb2.TypedDocumentRequest.FromString,
response_serializer=nexus_dot_models_dot_proto_dot_typed__document__pb2.TypedDocument.SerializeToString,
),
'roll': grpc.unary_unary_rpc_method_handler(
servicer.roll,
request_deserializer=nexus_dot_meta__api_dot_proto_dot_documents__service__pb2.RollRequest.FromString,
response_serializer=nexus_dot_meta__api_dot_proto_dot_documents__service__pb2.RollResponse.SerializeToString,
),
'top_missed': grpc.unary_unary_rpc_method_handler(
servicer.top_missed,
request_deserializer=nexus_dot_meta__api_dot_proto_dot_documents__service__pb2.TopMissedRequest.FromString,
response_serializer=nexus_dot_meta__api_dot_proto_dot_documents__service__pb2.TopMissedResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'nexus.meta_api.proto.Documents', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
# This class is part of an EXPERIMENTAL API.
class Documents(object):
"""Missing associated documentation comment in .proto file."""
@staticmethod
def get(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/nexus.meta_api.proto.Documents/get',
nexus_dot_meta__api_dot_proto_dot_documents__service__pb2.TypedDocumentRequest.SerializeToString,
nexus_dot_models_dot_proto_dot_typed__document__pb2.TypedDocument.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def roll(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/nexus.meta_api.proto.Documents/roll',
nexus_dot_meta__api_dot_proto_dot_documents__service__pb2.RollRequest.SerializeToString,
nexus_dot_meta__api_dot_proto_dot_documents__service__pb2.RollResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def top_missed(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/nexus.meta_api.proto.Documents/top_missed',
nexus_dot_meta__api_dot_proto_dot_documents__service__pb2.TopMissedRequest.SerializeToString,
nexus_dot_meta__api_dot_proto_dot_documents__service__pb2.TopMissedResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

View File

@ -1,59 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: nexus/meta_api/proto/search_service.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from nexus.models.proto import \
typed_document_pb2 as nexus_dot_models_dot_proto_dot_typed__document__pb2
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n)nexus/meta_api/proto/search_service.proto\x12\x14nexus.meta_api.proto\x1a\'nexus/models/proto/typed_document.proto\"\x8c\x01\n\x0eScoredDocument\x12H\n\x0etyped_document\x18\x01 \x01(\x0b\x32!.nexus.models.proto.TypedDocumentR\rtypedDocument\x12\x14\n\x05score\x18\x02 \x01(\x01R\x05score\x12\x1a\n\x08position\x18\x03 \x01(\rR\x08position\"\xc1\x01\n\rSearchRequest\x12#\n\rindex_aliases\x18\x01 \x03(\tR\x0cindexAliases\x12\x14\n\x05query\x18\x02 \x01(\tR\x05query\x12\x12\n\x04page\x18\x03 \x01(\rR\x04page\x12\x1b\n\tpage_size\x18\x04 \x01(\rR\x08pageSize\x12\x1a\n\x08language\x18\x05 \x01(\tR\x08language\x12(\n\x10with_user_intent\x18\x06 \x01(\x08R\x0ewithUserIntent\"\x92\x01\n\x0eSearchResponse\x12O\n\x10scored_documents\x18\x01 \x03(\x0b\x32$.nexus.meta_api.proto.ScoredDocumentR\x0fscoredDocuments\x12\x19\n\x08has_next\x18\x02 \x01(\x08R\x07hasNext\x12\x14\n\x05\x63ount\x18\x03 \x01(\rR\x05\x63ount2_\n\x06Search\x12U\n\x06search\x12#.nexus.meta_api.proto.SearchRequest\x1a$.nexus.meta_api.proto.SearchResponse\"\x00\x62\x06proto3')
_SCOREDDOCUMENT = DESCRIPTOR.message_types_by_name['ScoredDocument']
_SEARCHREQUEST = DESCRIPTOR.message_types_by_name['SearchRequest']
_SEARCHRESPONSE = DESCRIPTOR.message_types_by_name['SearchResponse']
ScoredDocument = _reflection.GeneratedProtocolMessageType('ScoredDocument', (_message.Message,), {
'DESCRIPTOR' : _SCOREDDOCUMENT,
'__module__' : 'nexus.meta_api.proto.search_service_pb2'
# @@protoc_insertion_point(class_scope:nexus.meta_api.proto.ScoredDocument)
})
_sym_db.RegisterMessage(ScoredDocument)
SearchRequest = _reflection.GeneratedProtocolMessageType('SearchRequest', (_message.Message,), {
'DESCRIPTOR' : _SEARCHREQUEST,
'__module__' : 'nexus.meta_api.proto.search_service_pb2'
# @@protoc_insertion_point(class_scope:nexus.meta_api.proto.SearchRequest)
})
_sym_db.RegisterMessage(SearchRequest)
SearchResponse = _reflection.GeneratedProtocolMessageType('SearchResponse', (_message.Message,), {
'DESCRIPTOR' : _SEARCHRESPONSE,
'__module__' : 'nexus.meta_api.proto.search_service_pb2'
# @@protoc_insertion_point(class_scope:nexus.meta_api.proto.SearchResponse)
})
_sym_db.RegisterMessage(SearchResponse)
_SEARCH = DESCRIPTOR.services_by_name['Search']
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
_SCOREDDOCUMENT._serialized_start=109
_SCOREDDOCUMENT._serialized_end=249
_SEARCHREQUEST._serialized_start=252
_SEARCHREQUEST._serialized_end=445
_SEARCHRESPONSE._serialized_start=448
_SEARCHRESPONSE._serialized_end=594
_SEARCH._serialized_start=596
_SEARCH._serialized_end=691
# @@protoc_insertion_point(module_scope)

View File

@ -1,67 +0,0 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from nexus.meta_api.proto import \
search_service_pb2 as \
nexus_dot_meta__api_dot_proto_dot_search__service__pb2
class SearchStub(object):
"""Missing associated documentation comment in .proto file."""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.search = channel.unary_unary(
'/nexus.meta_api.proto.Search/search',
request_serializer=nexus_dot_meta__api_dot_proto_dot_search__service__pb2.SearchRequest.SerializeToString,
response_deserializer=nexus_dot_meta__api_dot_proto_dot_search__service__pb2.SearchResponse.FromString,
)
class SearchServicer(object):
"""Missing associated documentation comment in .proto file."""
def search(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def add_SearchServicer_to_server(servicer, server):
rpc_method_handlers = {
'search': grpc.unary_unary_rpc_method_handler(
servicer.search,
request_deserializer=nexus_dot_meta__api_dot_proto_dot_search__service__pb2.SearchRequest.FromString,
response_serializer=nexus_dot_meta__api_dot_proto_dot_search__service__pb2.SearchResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'nexus.meta_api.proto.Search', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
# This class is part of an EXPERIMENTAL API.
class Search(object):
"""Missing associated documentation comment in .proto file."""
@staticmethod
def search(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/nexus.meta_api.proto.Search/search',
nexus_dot_meta__api_dot_proto_dot_search__service__pb2.SearchRequest.SerializeToString,
nexus_dot_meta__api_dot_proto_dot_search__service__pb2.SearchResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

View File

@ -5,13 +5,13 @@ from typing import Optional
from urllib.parse import quote
import numpy as np
from izihawa_types.datetime import CustomDatetime
from library.telegram.common import close_button
from nexus.translations import t
from nlptools.izihawa_nlptools.utils import (
from izihawa_nlptools.utils import (
despace_full,
escape_format,
)
from izihawa_types.datetime import CustomDatetime
from library.telegram.common import close_button
from nexus.translations import t
from telethon import Button
from .common import (