Skip to content

Commit 0abcf8b

Browse files
authored
fix: linting issues (#433)
* [linting] fix iterable issue in get log file action for legacy case * [linting] services.utils * [linting] search artifacts action * ignore whole psycopg2 module while linting as psycopg2.errors ignoring does not work anymore
1 parent 159f714 commit 0abcf8b

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

services/ui_backend_service/data/cache/get_log_file_action.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ def get_log_content(self, task: Task, logtype: str):
399399
), ]
400400
# Note this is inefficient - we will load a 1GB log even if we only want last 100 bytes.
401401
# Doing this efficiently is a step change in complexity and effort - we can do it when justified in future.
402-
raw_content = get_log_content(task, logtype)
402+
raw_content = list(get_log_content(task, logtype))
403403
if len(raw_content) == 0:
404404
return raw_content # empty list
405405

services/ui_backend_service/data/cache/search_artifacts_action.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def format_loc(x):
142142
if key in results:
143143
load_success, value, detail, trace = unpack_processed_value(json.loads(results[key]))
144144
else:
145-
load_success, value, _ = False, None, None
145+
load_success, value, detail, trace = False, None, None, None
146146
# keep the matching case-insensitive
147147
matches = filter_fn(str(value).lower(), searchterm.lower())
148148

services/utils/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ def connection_string_url(self, type=None):
272272
base_url = f'postgresql://{quote(self._user)}:{quote(self._password)}@{self._host}:{self._port}/{self._database_name}'
273273
elif type == DBType.READER:
274274
base_url = f'postgresql://{quote(self._user)}:{quote(self._password)}@{self._read_replica_host}:{self._port}/{self._database_name}'
275+
else:
276+
raise Exception("Unsupported DBType %s" % type)
275277

276278
if (self._ssl_mode in ['allow', 'prefer', 'require', 'verify-ca', 'verify-full']):
277279
ssl_query = f'sslmode={self._ssl_mode}'

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ passenv = MF_METADATA_DB_HOST,MF_METADATA_DB_PORT,MF_METADATA_DB_USER,MF_METADAT
1010
extras = tests
1111

1212
[testenv:pylint]
13-
commands = pylint -E services --ignored-modules=psycopg2.errors,pygit2
13+
commands = pylint -E services --ignored-modules=psycopg2,pygit2
1414

1515
[testenv:unit]
1616
commands = pytest --cov=services -m unit_tests

0 commit comments

Comments
 (0)