MCPcopy Create free account
hub / github.com/daniel2005d/mapXplore / run

Method run

middle/data_operation.py:221–253  ·  view source on GitHub ↗
(self, option:QueryType, value, hash_type:str=None)

Source from the content-addressed store, hash-verified

219 return information
220
221 def run(self, option:QueryType, value, hash_type:str=None) -> Result:
222 try:
223 results = None
224 self._create_dbCursor()
225 if self._cursor is not None:
226 if hash_type is not None:
227 hashes = []
228 for text in value.split(','):
229 hashes.append(self._get_hashes(hash_type, text))
230 value=','.join(hashes)
231
232 if option == QueryType.TABLES:
233 results = self._filter_tables(value) #self._cursor.search_tables(value)
234 elif option == QueryType.COLUMNS:
235 results = self._filter_columns(value)
236 elif option == QueryType.VALUES:
237 results = self._filter_by_value(value)
238
239 if results is not None and option != QueryType.VALUES:
240 criterial = "Tables" if option == QueryType.TABLES else "Columns"
241
242 if self._save_results(criterial, option, results):
243 AnsiPrint.printResult(results)
244 AnsiPrint.print(locale.get("summary"))
245 AnsiPrint.print(locale.get("summary_total").format(length=results.length))
246 else:
247 AnsiPrint.print(locale.get("notfound").format(word=value))
248
249
250 except Exception as e:
251 AnsiPrint.print_error(e)
252
253 return results
254
255 def select(self, tables:list[str]) -> None:
256 self._create_dbCursor()

Callers 1

do_searchMethod · 0.80

Calls 11

_create_dbCursorMethod · 0.95
_get_hashesMethod · 0.95
_filter_tablesMethod · 0.95
_filter_columnsMethod · 0.95
_filter_by_valueMethod · 0.95
_save_resultsMethod · 0.95
printResultMethod · 0.80
appendMethod · 0.45
printMethod · 0.45
formatMethod · 0.45
print_errorMethod · 0.45

Tested by

no test coverage detected