8000 refactor: unused definitions by florian-hoenicke · Pull Request #1660 · jina-ai/serve · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

refactor: unused definitions #1660

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

Merged
merged 2 commits into from
Jan 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions jina/clients/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ def pprint_routes(resp: 'Response', stack_limit: int = 3):

header = [colored(v, attrs=['bold']) for v in ('Pod', 'Time', 'Exception')]

# poor-man solution
table = []

def add_row(x):
for h, y in zip(header, x):
table.append(f'{h}\n{y}\n{"-" * 10}')

def visualize(x):
print('\n'.join(x))

with ImportExtensions(required=False):
from prettytable import PrettyTable, ALL
table = PrettyTable(field_names=header, align='l', hrules=ALL)
Expand Down
2 changes: 1 addition & 1 deletion jina/peapods/runtimes/zmq/zed.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def _msg_callback(self, msg: 'Message') -> None:
# notice how executor related exceptions are handled here
# generally unless executor throws an OSError, the exception are caught and solved inplace
self._zmqlet.send_message(self._callback(msg))
except RuntimeTerminated as ex:
except RuntimeTerminated:
# this is the proper way to end when a terminate signal is sent
self._zmqlet.send_message(msg)
self._zmqlet.close()
Expand Down
14 changes: 7 additions & 7 deletions tests/jinad/integration/api/endpoints/test_logging_endpoint.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import json
import uuid
import time
import random
import pathlib
from multiprocessing import Process, Event
import random
import time
import uuid
from datetime import datetime, timezone
from multiprocessing import Process, Event

import pytest

from daemon.config import log_config
from daemon.excepts import NoSuchFileException
from daemon.config import log_config, fastapi_config

LOG_MESSAGE = 'log message'
TIMEOUT_ERROR_CODE = 4000
Expand All @@ -33,8 +33,8 @@ def feed_path_logs(filepath, total_lines, sleep, mp_event=None):
@pytest.mark.asyncio
async def test_logging_endpoint_invalid_id(fastapi_client):
log_id = uuid.uuid1()
with pytest.raises(NoSuchFileException) as response:
with fastapi_client.websocket_connect(f'logstream/{log_id}') as websocket:
with pytest.raises(NoSuchFileException):
with fastapi_client.websocket_connect(f'logstream/{log_id}'):
pass


Expand Down
1 change: 0 additions & 1 deletion tests/unit/drivers/test_cache_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ def test_cache_content_driver_same_content(tmpdir, test_metas):
assert doc1.content_hash == doc2.content_hash

driver = MockBaseCacheDriver()
filename = None

with DocIDCache(tmpdir, metas=test_metas, field=CONTENT_HASH_KEY) as executor:
driver.attach(executor=executor, runtime=None)
Expand Down
2 changes: 1 addition & 10000 1 deletion tests/unit/drivers/test_rankingevaluation_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def add_matches(doc: jina_pb2.DocumentProto):
chunk_gt.granularity = 1
add_matches(chunk_doc)
add_matches(chunk_gt)
chunk_gt_wrong = gt.chunks.add()
_ = gt.chunks.add()
return req


Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_echostream.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_simple_zmqlet():
])

logger = logging.getLogger('zmq-test')
with BasePea(args2) as z1, Zmqlet(args, logger) as z:
with BasePea(args2), Zmqlet(args, logger) as z:
req = jina_pb2.RequestProto()
req.request_id = get_random_identity()
d = req.index.docs.add()
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_exectype.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_exec_type(tmpdir):

BaseIndexer().save_config(os.path.join(tmpdir, 'tmp.yml'))
with open(os.path.join(tmpdir, 'tmp.yml')) as fp:
s = JAML.load(fp)
_ = JAML.load(fp)

def assert_bi():
b = BaseIndexer(1)
Expand Down
2 changes: 0 additions & 2 deletions tests/unit/types/document/test_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ def test_convert_text_to_uri(converter):
('https://google.com/index.html', 'text/html')])
def test_convert_uri_to_text(uri, mimetype):
doc = Document(uri=uri, mime_type=mimetype)
intialiazed_buffer = doc.buffer
doc.convert_uri_to_text()
converted_buffer = doc.buffer
if mimetype == 'text/html':
assert '<!doctype html>' in doc.text
elif mimetype == 'text/x-python':
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/types/document/test_multimodal_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def test_from_chunks_granularity_2(chunk_5, chunk_6):

def test_assert_granularity(chunk_1, chunk_6):
with pytest.raises(BadDocType):
md = MultimodalDocument(chunks=[chunk_1, chunk_6])
_ = MultimodalDocument(chunks=[chunk_1, chunk_6])


def test_from_chunks_fail_length_mismatch(chunk_1, chunk_2, chunk_3):
Expand Down
0